Skip to content

Allow WideEventLogger to serve as default package logger#74

Merged
mishankov merged 3 commits intomainfrom
we-logging-as-default
Mar 19, 2026
Merged

Allow WideEventLogger to serve as default package logger#74
mishankov merged 3 commits intomainfrom
we-logging-as-default

Conversation

@mishankov
Copy link
Copy Markdown
Member

Summary

  • make WideEventLogger implement the package logger interface so it can be used via log.SetDefault(...)
  • add Debug/Info/Warn/Error (+ context variants) on WideEventLogger that emit short-lived log.record events
  • route simple log calls through the existing sampler path, preserving sampling behavior for both simple logs and explicit wide events
  • normalize slog-style args for simple logs (including groups, duplicate keys, and malformed args handling)
  • update log package docs to describe using WideEventLogger as the default logger
  • add focused tests covering default logger usage, context attribute propagation, sampler behavior, arg normalization, and error attribute handling

Testing

  • Added unit tests in log/wideevent_logger_test.go for default logger wiring and simple log behavior
  • Added checks for context key extraction (traceId, serviceName, custom context key)
  • Added checks that sampler decisions are respected for both Info(...) and WriteEvent(...)
  • Added checks for slog arg normalization (slog.Group, duplicate keys, !BADKEY behavior)
  • Not run (test execution output was not provided in this patch context)

- implement logger interface methods on `WideEventLogger` (`Debug`/`Info`/`Warn`/`Error` + context variants)
- route simple log calls through wide-event sampling as `log.record` events
- add tests for default logger usage, sampler behavior, arg normalization, and docs update
@mishankov mishankov merged commit 30a55ce into main Mar 19, 2026
8 checks passed
@mishankov mishankov deleted the we-logging-as-default branch March 19, 2026 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant