From d02b63c3529e529314acbfcd85bf9bb31b94a4c0 Mon Sep 17 00:00:00 2001 From: Ryan Rose Date: Fri, 7 Dec 2018 13:07:11 -0800 Subject: [PATCH] Use generic logging if the logger.Logger is nil. Generic logging doesn't need any extra state and thus we can handle the case of a nil receiver gracefully. PiperOrigin-RevId: 224564914 --- logger/logger.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logger/logger.go b/logger/logger.go index aa9cca0a4e1..2a3682dfaf5 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -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 }