diff --git a/pkg/executor/executor.go b/pkg/executor/executor.go index 2b4c1f44..56060ea7 100644 --- a/pkg/executor/executor.go +++ b/pkg/executor/executor.go @@ -82,7 +82,9 @@ func NewExecutor(dir string, entrypoint string, args []string, envs []string) *E } func (e *Executor) Output() ([]byte, error) { - e.logger.Debug("Executing command", strings.Join(e.cmd.Args, " "), e.cmd.Dir) + e.logger.Debug("Executing command", + slog.String("command", strings.Join(e.cmd.Args, " ")), + slog.String("dir", e.cmd.Dir)) return e.cmd.Output() } @@ -98,7 +100,9 @@ func (e *Executor) RunAndLogLines(logLabels map[string]string) (*CmdUsage, error stdoutLogEntry := logEntry.With("output", "stdout") stderrLogEntry := logEntry.With("output", "stderr") - log.Debug("Executing command", slog.String("command", strings.Join(e.cmd.Args, " ")), slog.String("dir", e.cmd.Dir)) + log.Debug("Executing command", + slog.String("command", strings.Join(e.cmd.Args, " ")), + slog.String("dir", e.cmd.Dir)) plo := &proxyLogger{e.logProxyHookJSON, e.proxyJsonKey, stdoutLogEntry, make([]byte, 0)} ple := &proxyLogger{e.logProxyHookJSON, e.proxyJsonKey, stderrLogEntry, make([]byte, 0)} diff --git a/pkg/hook/controller/conversion_bindings_controller.go b/pkg/hook/controller/conversion_bindings_controller.go index 3975f827..8875e6f9 100644 --- a/pkg/hook/controller/conversion_bindings_controller.go +++ b/pkg/hook/controller/conversion_bindings_controller.go @@ -3,9 +3,10 @@ package controller import ( "log/slog" - "github.com/deckhouse/deckhouse/pkg/log" v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + "github.com/deckhouse/deckhouse/pkg/log" + bctx "github.com/flant/shell-operator/pkg/hook/binding_context" htypes "github.com/flant/shell-operator/pkg/hook/types" "github.com/flant/shell-operator/pkg/webhook/conversion" @@ -84,7 +85,7 @@ func (c *ConversionBindingsController) CanHandleEvent(crdName string, _ *v1.Conv func (c *ConversionBindingsController) HandleEvent(crdName string, request *v1.ConversionRequest, rule conversion.Rule) BindingExecutionInfo { _, hasKey := c.Links[crdName] if !hasKey { - log.Error("Possible bug!!! No binding for conversion event for crd", slog.String("name", crdName)) + log.Error("Possible bug!!! No binding for conversion event for crd", slog.String("crd", crdName)) return BindingExecutionInfo{ BindingContext: []bctx.BindingContext{}, AllowFailure: false, diff --git a/pkg/kube_events_manager/namespace_informer.go b/pkg/kube_events_manager/namespace_informer.go index 29206412..3c134941 100644 --- a/pkg/kube_events_manager/namespace_informer.go +++ b/pkg/kube_events_manager/namespace_informer.go @@ -7,13 +7,14 @@ import ( "fmt" "log/slog" - "github.com/deckhouse/deckhouse/pkg/log" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" corev1 "k8s.io/client-go/informers/core/v1" "k8s.io/client-go/tools/cache" + "github.com/deckhouse/deckhouse/pkg/log" + klient "github.com/flant/kube-client/client" ) @@ -124,7 +125,7 @@ func (ni *namespaceInformer) start() { log.Debug("Run namespace informer", slog.String("name", ni.Monitor.Metadata.DebugName)) if ni.SharedInformer == nil { log.Error("Possible BUG!!! Start called before createSharedInformer, ShredInformer is nil", - slog.String("name", ni.Monitor.Metadata.DebugName)) + slog.String("debugName", ni.Monitor.Metadata.DebugName)) return } cctx, cancel := context.WithCancel(ni.ctx) @@ -140,10 +141,10 @@ func (ni *namespaceInformer) start() { return ni.SharedInformer.HasSynced(), nil }); err != nil { ni.Monitor.Logger.Error("Cache is not synced for informer", - slog.String("name", ni.Monitor.Metadata.DebugName)) + slog.String("debugName", ni.Monitor.Metadata.DebugName)) } - log.Debug("Informer is ready", slog.String("name", ni.Monitor.Metadata.DebugName)) + log.Debug("Informer is ready", slog.String("debugName", ni.Monitor.Metadata.DebugName)) } func (ni *namespaceInformer) pauseHandleEvents() { diff --git a/pkg/kube_events_manager/resource_informer.go b/pkg/kube_events_manager/resource_informer.go index 3ec965c8..8214ccd0 100644 --- a/pkg/kube_events_manager/resource_informer.go +++ b/pkg/kube_events_manager/resource_informer.go @@ -8,13 +8,14 @@ import ( "sync" "time" - "github.com/deckhouse/deckhouse/pkg/log" "github.com/gofrs/uuid/v5" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/tools/cache" + "github.com/deckhouse/deckhouse/pkg/log" + klient "github.com/flant/kube-client/client" "github.com/flant/shell-operator/pkg/app" "github.com/flant/shell-operator/pkg/filter/jq" @@ -121,10 +122,10 @@ func (ei *resourceInformer) createSharedInformer() (err error) { log.Err(err)) return err } - log.Debug("%GVR for kind", + log.Debug("GVR for kind", slog.String("debugName", ei.Monitor.Metadata.DebugName), slog.String("kind", ei.Monitor.Kind), - slog.String("GVR", ei.GroupVersionResource.String())) + slog.String("gvr", ei.GroupVersionResource.String())) // define tweakListOptions for informer fmtLabelSelector, err := FormatLabelSelector(ei.Monitor.LabelSelector) @@ -201,7 +202,7 @@ func (ei *resourceInformer) loadExistedObjects() error { Namespace(ei.Namespace). List(context.TODO(), ei.ListOptions) if err != nil { - log.Error("%s: initial list resources of kind '%s': %v", + log.Error("initial list resources of kind", slog.String("debugName", ei.Monitor.Metadata.DebugName), slog.String("kind", ei.Monitor.Kind), log.Err(err)) diff --git a/pkg/task/queue/task_queue.go b/pkg/task/queue/task_queue.go index 1f87ab91..f308cf34 100644 --- a/pkg/task/queue/task_queue.go +++ b/pkg/task/queue/task_queue.go @@ -365,7 +365,7 @@ func (q *TaskQueue) debugf(format string, args ...interface{}) { if !q.debug { return } - log.Debug("", fmt.Sprintf(format, args...)) + log.Debug("DEBUG", fmt.Sprintf(format, args...)) } func (q *TaskQueue) Stop() {