Skip to content

Commit

Permalink
Merge pull request #6 from madkins23/fix-zerolog
Browse files Browse the repository at this point in the history
Use proposed new zerolog function to fix breakage
  • Loading branch information
phsym authored Sep 23, 2024
2 parents 0b7a5ea + a54d659 commit 0098b07
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
6 changes: 1 addition & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ module github.com/phsym/zeroslog

go 1.21

require github.com/rs/zerolog v1.31.0
require github.com/rs/zerolog v1.33.0

require (
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
golang.org/x/sys v0.12.0 // indirect
)

// This version of rs/zerolog breaks phsym/zeroslog
exclude github.com/rs/zerolog v1.32.0

4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APP
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A=
github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
Expand Down
6 changes: 3 additions & 3 deletions zerolog.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (h *Handler) WithAttrs(attrs []slog.Attr) slog.Handler {
func (h *Handler) WithGroup(name string) slog.Handler {
return &groupHandler{
parent: h,
ctx: zerolog.Context{},
ctx: h.logger.With().Reset(),
name: strings.TrimSpace(name),
}
}
Expand Down Expand Up @@ -182,7 +182,7 @@ func (h *groupHandler) Handle(ctx context.Context, rec slog.Record) error {
func (h *groupHandler) WithAttrs(attrs []slog.Attr) slog.Handler {
return &groupHandler{
parent: h.parent,
ctx: mapAttrs(h.ctx.Logger().With(), attrs...),
ctx: mapAttrs(h.ctx.Logger().With().Reset(), attrs...),
name: h.name,
}
}
Expand All @@ -191,7 +191,7 @@ func (h *groupHandler) WithAttrs(attrs []slog.Attr) slog.Handler {
func (h *groupHandler) WithGroup(name string) slog.Handler {
return &groupHandler{
parent: h,
ctx: zerolog.Context{},
ctx: h.ctx.Logger().With().Reset(),
name: name,
}
}
Expand Down

0 comments on commit 0098b07

Please sign in to comment.