From f9773d123555675f8a60ee6594aaaf71e11890d0 Mon Sep 17 00:00:00 2001 From: erezrokah Date: Tue, 22 Oct 2024 14:51:14 +0100 Subject: [PATCH] fix: Ensure module field exists in all log messages --- plugin/plugin.go | 2 +- serve/plugin.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/plugin.go b/plugin/plugin.go index 7ad2824cfd..f15b42ff1c 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -210,7 +210,7 @@ func (p *Plugin) Targets() []BuildTarget { } func (p *Plugin) SetLogger(logger zerolog.Logger) { - p.logger = logger.With().Str("module", p.name+"-"+string(p.Kind())).Logger() + p.logger = logger } func (p *Plugin) Tables(ctx context.Context, options TableOptions) (schema.Tables, error) { diff --git a/serve/plugin.go b/serve/plugin.go index 6efde17940..9f32995190 100644 --- a/serve/plugin.go +++ b/serve/plugin.go @@ -134,6 +134,8 @@ func (s *PluginServe) newCmdPluginServe() *cobra.Command { logger = log.Output(zerolog.ConsoleWriter{Out: os.Stdout}).Level(zerologLevel) } + logger = logger.With().Str("module", s.plugin.Name()+"-"+string(s.plugin.Kind())).Logger() + shutdown, err := setupOtel(cmd.Context(), logger, s.plugin, otelEndpoint, otelEndpointInsecure) if err != nil { return fmt.Errorf("failed to setup OpenTelemetry: %w", err)