add metrics to repl
This commit is contained in:
@@ -100,10 +100,15 @@ func (r *REPL) Run(ctx context.Context, config app.Config) error {
|
||||
|
||||
// If the user types "exit" or "quit", break the loop and exit the REPL.
|
||||
if input == "exit" || input == "quit" {
|
||||
r.logAction("repl exit requested")
|
||||
fmt.Println("Goodbye!")
|
||||
break
|
||||
}
|
||||
|
||||
if input != "" {
|
||||
r.logAction("repl command: " + input)
|
||||
}
|
||||
|
||||
// Add the input to the history for future navigation.
|
||||
history = append(history, input)
|
||||
|
||||
@@ -144,3 +149,12 @@ func (r *REPL) SetChannels(feedbackChan chan task.ValidationFeedback, quitChan c
|
||||
r.feedbackChan = feedbackChan
|
||||
r.quitChan = quitChan
|
||||
}
|
||||
|
||||
func (r *REPL) logAction(action string) {
|
||||
if r.app != nil {
|
||||
r.app.LogAction(models.EncodeActionEvent(models.ActionEvent{
|
||||
Source: "repl",
|
||||
Action: action,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user