Skip to content

Commit

Permalink
[core/action] actor action logs action with attr crm=true
Browse files Browse the repository at this point in the history
Log example for restart --local
    │INF│ instance: foo: do [om foo restart --local] (origin user)
    │INF│ instance: foo: done [om foo restart --local] in 2.08030908s
    │INF│ instance: foo: do [om foo restart --local] (origin user)
    │INF│ instance: foo: done [om foo restart --local] in 2.766448559s
    is now
    │INF│ instance: foo: do stop [om foo restart --local] (origin user) CRM=true
    │INF│ instance: foo: done stop [om foo restart --local] in 2.08030908s CRM=true
    │INF│ instance: foo: do start [om foo restart --local] (origin user) CRM=true
    │INF│ instance: foo: done start [om foo restart --local] in 2.766448559s CRM=true
  • Loading branch information
cgalibern committed Oct 22, 2024
1 parent 0d51b96 commit c0398a9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/object/core_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,12 @@ func (t *actor) action(ctx context.Context, fn resourceset.DoFunc) error {
Attr("argv", os.Args).
Attr("cwd", wd).
Attr("action", action.Name).
Attr("origin", env.Origin())
logger.Infof("do %s (origin %s)", os.Args, env.Origin())
Attr("origin", env.Origin()).
Attr("crm", "true")
logger.Infof("do %s %s (origin %s)", action.Name, os.Args, env.Origin())
beginTime := time.Now()
defer func() {
logger.Attr("duration", time.Now().Sub(beginTime)).Infof("done %s in %s", os.Args, time.Now().Sub(beginTime))
logger.Attr("duration", time.Now().Sub(beginTime)).Infof("done %s %s in %s", action.Name, os.Args, time.Now().Sub(beginTime))
}()

// daemon instance monitor updates
Expand Down

0 comments on commit c0398a9

Please sign in to comment.