Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
fix(adapter/slog): fix badkey bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nikoksr committed Jul 24, 2023
1 parent b6052e7 commit 1ac042f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions adapter/slog/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type (
Context struct {
level slog.Level
logger *slog.Logger
fields []slog.Attr
fields []any
}
)

Expand All @@ -39,7 +39,7 @@ func (a *Adapter) newContext(level slog.Level) *Context {
return &Context{
level: level,
logger: a.logger,
fields: make([]slog.Attr, 0),
fields: make([]any, 0),
}
}

Expand Down Expand Up @@ -552,8 +552,8 @@ func (c *Context) Msg(msg string) {
return
}

c.logger.Log(context.Background(), c.level, msg, c.fields)
c.fields = make([]slog.Attr, 0) // reset fields
c.logger.Log(context.Background(), c.level, msg, c.fields...)
c.fields = make([]any, 0) // reset fields
}

// Msgf sends the LoggerContext with formatted msg to the logger.
Expand Down

0 comments on commit 1ac042f

Please sign in to comment.