Skip to content

Commit

Permalink
feat: Ignore odd fields passed to DefaultFields.
Browse files Browse the repository at this point in the history
  • Loading branch information
iamd3vil committed Jul 8, 2022
1 parent e95c548 commit ab5d82f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions log.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ func New(opts Opts) Logger {
opts.CallerSkipFrameCount = 3
}

if len(opts.DefaultFields)%2 != 0 {
opts.DefaultFields = opts.DefaultFields[0 : len(opts.DefaultFields)-1]
}

return Logger{
out: newSyncWriter(opts.Writer),
Opts: opts,
Expand Down

0 comments on commit ab5d82f

Please sign in to comment.