Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Ensure module field exists in all log messages #1941

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions serve/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Copy link
Member Author

@erezrokah erezrokah Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not shown in the diff but we do s.plugin.SetLogger(logger) a bit below


shutdown, err := setupOtel(cmd.Context(), logger, s.plugin, otelEndpoint, otelEndpointInsecure)
if err != nil {
return fmt.Errorf("failed to setup OpenTelemetry: %w", err)
Expand Down
Loading