summaryrefslogtreecommitdiffstats
path: root/vendor/go.uber.org/zap/logger.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/go.uber.org/zap/logger.go')
-rw-r--r--vendor/go.uber.org/zap/logger.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/vendor/go.uber.org/zap/logger.go b/vendor/go.uber.org/zap/logger.go
index dc8f6e3a..cd6e1955 100644
--- a/vendor/go.uber.org/zap/logger.go
+++ b/vendor/go.uber.org/zap/logger.go
@@ -258,6 +258,12 @@ func (log *Logger) check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry {
// (e.g., Check, Info, Fatal).
const callerSkipOffset = 2
+ // Check the level first to reduce the cost of disabled log calls.
+ // Since Panic and higher may exit, we skip the optimization for those levels.
+ if lvl < zapcore.DPanicLevel && !log.core.Enabled(lvl) {
+ return nil
+ }
+
// Create basic checked entry thru the core; this will be non-nil if the
// log message will actually be written somewhere.
ent := zapcore.Entry{