From c0398a988c4c73d0c041fcf3d429e6a1e73498c9 Mon Sep 17 00:00:00 2001 From: Cyril Galibern Date: Tue, 22 Oct 2024 17:08:46 +0200 Subject: [PATCH] [core/action] actor action logs action with attr crm=true MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- core/object/core_action.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/object/core_action.go b/core/object/core_action.go index f7b7e8ca2..0f41ef2f7 100644 --- a/core/object/core_action.go +++ b/core/object/core_action.go @@ -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