summaryrefslogtreecommitdiffstats
path: root/vendor/go.uber.org/zap/options.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/go.uber.org/zap/options.go')
-rw-r--r--vendor/go.uber.org/zap/options.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/vendor/go.uber.org/zap/options.go b/vendor/go.uber.org/zap/options.go
index 59f1b54a..0135c209 100644
--- a/vendor/go.uber.org/zap/options.go
+++ b/vendor/go.uber.org/zap/options.go
@@ -86,15 +86,15 @@ func Development() Option {
})
}
-// AddCaller configures the Logger to annotate each message with the filename
-// and line number of zap's caller. See also WithCaller.
+// AddCaller configures the Logger to annotate each message with the filename,
+// line number, and function name of zap's caller. See also WithCaller.
func AddCaller() Option {
return WithCaller(true)
}
-// WithCaller configures the Logger to annotate each message with the filename
-// and line number of zap's caller, or not, depending on the value of enabled.
-// This is a generalized form of AddCaller.
+// WithCaller configures the Logger to annotate each message with the filename,
+// line number, and function name of zap's caller, or not, depending on the
+// value of enabled. This is a generalized form of AddCaller.
func WithCaller(enabled bool) Option {
return optionFunc(func(log *Logger) {
log.addCaller = enabled
@@ -125,9 +125,16 @@ func IncreaseLevel(lvl zapcore.LevelEnabler) Option {
return optionFunc(func(log *Logger) {
core, err := zapcore.NewIncreaseLevelCore(log.core, lvl)
if err != nil {
- fmt.Fprintf(log.errorOutput, "failed to IncreaseLevel: %v", err)
+ fmt.Fprintf(log.errorOutput, "failed to IncreaseLevel: %v\n", err)
} else {
log.core = core
}
})
}
+
+// OnFatal sets the action to take on fatal logs.
+func OnFatal(action zapcore.CheckWriteAction) Option {
+ return optionFunc(func(log *Logger) {
+ log.onFatal = action
+ })
+}