Skip to content

Commit

Permalink
ref: rename logger msg key to message (#462)
Browse files Browse the repository at this point in the history
* rename logger msg key to message
  • Loading branch information
viglia authored May 9, 2024
1 parent 9bd0e92 commit c316c68
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
- Bump golangci/golangci-lint-action from 5 to 6 ([#459](https://github.com/getsentry/vroom/pull/459))
- Use SendEventWithContext to bail out from requests when client disconnect ([#460](https://github.com/getsentry/vroom/pull/460))
- Set logger for sentry client and replace zerolog with slog ([#461](https://github.com/getsentry/vroom/pull/461))
- Rename logger msg key to message ([#462](https://github.com/getsentry/vroom/pull/462))

## 23.12.0

Expand Down
1 change: 0 additions & 1 deletion cmd/vroom/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ func main() {
if err != nil {
log.Fatal("can't initialize sentry", err)
}
sentry.Logger = slog.NewLogLogger(slog.NewJSONHandler(os.Stdout, nil), slog.LevelError)

router, err := env.newRouter()
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions internal/logutil/logutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@ import (
func ConfigureLogger() {
slog.SetDefault(slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{
Level: slog.LevelInfo,
ReplaceAttr: func(_ []string, a slog.Attr) slog.Attr {
if a.Key == slog.MessageKey {
a.Key = "message"
}
return a
},
})))
}

0 comments on commit c316c68

Please sign in to comment.