Skip to content

Commit

Permalink
Use generic logging if the logger.Logger is nil.
Browse files Browse the repository at this point in the history
Generic logging doesn't need any extra state and thus we can handle the case of a nil receiver gracefully.

PiperOrigin-RevId: 224564914
  • Loading branch information
RyRose authored and manugarg committed Dec 11, 2018
1 parent 8792bab commit d02b63c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (l *Logger) log(severity logging.Severity, payload interface{}) {
textPayload = textPayload[:MaxLogEntrySize-truncateMsgLen] + truncateMsg
payload = textPayload
}
if l.logc == nil {
if l == nil || l.logc == nil {
genericLog(severity, textPayload)
return
}
Expand Down

0 comments on commit d02b63c

Please sign in to comment.