Skip to content

Commit

Permalink
slogutil: imp code
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizzick committed Oct 22, 2024
1 parent c6caad7 commit e30fd00
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion logutil/slogutil/jsonhybrid.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
//
// Example of output:
//
// {"time":"2023-12-01T12:34:56.789Z","level":"INFO","msg":"listening; attrs: prefix=websvc url=http://127.0.0.1:8080"}
// {"severity":"NORMAL","message":"time=2024-10-22T12:09:59.525+03:00 level=INFO msg=listening prefix=websvc server=http://127.0.0.1:8181"}
type JSONHybridHandler struct {
json *slog.JSONHandler
attrPool *syncutil.Pool[[]slog.Attr]
Expand Down
4 changes: 2 additions & 2 deletions logutil/slogutil/legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ var legacyTextHandlerOpts = &slog.HandlerOptions{
ReplaceAttr: legacyRemoveTopLevel,
}

// legacyRemoveTopLevel is a [slog.HandlerOptions.ReplaceAttr] function that removes
// "level", "msg", "time", and "source" attributes.
// legacyRemoveTopLevel is a [slog.HandlerOptions.ReplaceAttr] function that
// removes "level", "msg", "time", and "source" attributes.
func legacyRemoveTopLevel(groups []string, a slog.Attr) (res slog.Attr) {
if len(groups) > 0 {
return a
Expand Down

0 comments on commit e30fd00

Please sign in to comment.