Skip to content

Commit

Permalink
logging: ignore nil caller
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Apr 28, 2023
1 parent 299fb3a commit 5901841
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion logging/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,12 @@ func (zc *zapCore) Write(ze zapcore.Entry, zf []zapcore.Field) error {
Timestamp: ze.Time,
Level: ze.Level,
Name: ze.LoggerName,
Caller: ze.Caller.String(),
Message: ze.Message,
Fields: make(map[string]any),
}
if ze.Caller.Defined {
entry.Caller = ze.Caller.String()
}
if err := json.Unmarshal(buf.Bytes(), &entry.Fields); err != nil {
return fmt.Errorf("failed to parse log entry: %w", err)
}
Expand Down

0 comments on commit 5901841

Please sign in to comment.