Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Evsyukov Denis <[email protected]> diff --git c/pkg/executor/executor.go i/pkg/executor/executor.go index 2b4c1f4..56060ea 100644 --- c/pkg/executor/executor.go +++ i/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 c/pkg/executor/executor_test.go i/pkg/executor/executor_test.go index 7c707d0..04fa272 100644 --- c/pkg/executor/executor_test.go +++ i/pkg/executor/executor_test.go @@ -107,8 +107,8 @@ func TestRunAndLogLines(t *testing.T) { _, err := ex.RunAndLogLines(map[string]string{"a": "b"}) assert.NoError(t, err) - assert.Equal(t, buf.String(), `{"level":"debug","msg":"json log line not map[string]interface{}","source":"executor/executor.go:173","a":"b","line":["a","b","c"],"output":"stdout","time":"2006-01-02T15:04:05Z"}`+"\n"+ - `{"level":"info","msg":"[\"a\",\"b\",\"c\"]\n","source":"executor/executor.go:176","a":"b","output":"stdout","time":"2006-01-02T15:04:05Z"}`+"\n") + assert.Equal(t, buf.String(), `{"level":"debug","msg":"json log line not map[string]interface{}","source":"executor/executor.go:177","a":"b","line":["a","b","c"],"output":"stdout","time":"2006-01-02T15:04:05Z"}`+"\n"+ + `{"level":"info","msg":"[\"a\",\"b\",\"c\"]\n","source":"executor/executor.go:180","a":"b","output":"stdout","time":"2006-01-02T15:04:05Z"}`+"\n") buf.Reset() }) diff --git c/pkg/hook/controller/conversion_bindings_controller.go i/pkg/hook/controller/conversion_bindings_controller.go index 3975f82..a7920ef 100644 --- c/pkg/hook/controller/conversion_bindings_controller.go +++ i/pkg/hook/controller/conversion_bindings_controller.go @@ -84,7 +84,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 c/pkg/kube_events_manager/namespace_informer.go i/pkg/kube_events_manager/namespace_informer.go index 2920641..a97c6bb 100644 --- c/pkg/kube_events_manager/namespace_informer.go +++ i/pkg/kube_events_manager/namespace_informer.go @@ -124,7 +124,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 +140,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 c/pkg/kube_events_manager/resource_informer.go i/pkg/kube_events_manager/resource_informer.go index 1307a1d..0da0991 100644 --- c/pkg/kube_events_manager/resource_informer.go +++ i/pkg/kube_events_manager/resource_informer.go @@ -117,11 +117,10 @@ func (ei *resourceInformer) createSharedInformer() error { if ei.GroupVersionResource, err = ei.KubeClient.GroupVersionResource(ei.Monitor.ApiVersion, ei.Monitor.Kind); err != nil { return fmt.Errorf("%s: Cannot get GroupVersionResource info for apiVersion '%s' kind '%s' from api-server. Possibly CRD is not created before informers are started. Error was: %w", ei.Monitor.Metadata.DebugName, ei.Monitor.ApiVersion, ei.Monitor.Kind, 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) @@ -196,7 +195,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 c/pkg/task/queue/task_queue.go i/pkg/task/queue/task_queue.go index 54c0fab..44e64bc 100644 --- c/pkg/task/queue/task_queue.go +++ i/pkg/task/queue/task_queue.go @@ -384,7 +384,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() {
- Loading branch information