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 the user types "exit" or "quit", break the loop and exit the REPL.
|
||||||
if input == "exit" || input == "quit" {
|
if input == "exit" || input == "quit" {
|
||||||
|
r.logAction("repl exit requested")
|
||||||
fmt.Println("Goodbye!")
|
fmt.Println("Goodbye!")
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if input != "" {
|
||||||
|
r.logAction("repl command: " + input)
|
||||||
|
}
|
||||||
|
|
||||||
// Add the input to the history for future navigation.
|
// Add the input to the history for future navigation.
|
||||||
history = append(history, input)
|
history = append(history, input)
|
||||||
|
|
||||||
@@ -144,3 +149,12 @@ func (r *REPL) SetChannels(feedbackChan chan task.ValidationFeedback, quitChan c
|
|||||||
r.feedbackChan = feedbackChan
|
r.feedbackChan = feedbackChan
|
||||||
r.quitChan = quitChan
|
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