forked from lug/matterbridge
Use mattermost v5 module (#1192)
This commit is contained in:
30
vendor/go.uber.org/zap/options.go
generated
vendored
30
vendor/go.uber.org/zap/options.go
generated
vendored
@@ -20,7 +20,11 @@
|
||||
|
||||
package zap
|
||||
|
||||
import "go.uber.org/zap/zapcore"
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
||||
// An Option configures a Logger.
|
||||
type Option interface {
|
||||
@@ -83,10 +87,17 @@ func Development() Option {
|
||||
}
|
||||
|
||||
// AddCaller configures the Logger to annotate each message with the filename
|
||||
// and line number of zap's caller.
|
||||
// and line number 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.
|
||||
func WithCaller(enabled bool) Option {
|
||||
return optionFunc(func(log *Logger) {
|
||||
log.addCaller = true
|
||||
log.addCaller = enabled
|
||||
})
|
||||
}
|
||||
|
||||
@@ -107,3 +118,16 @@ func AddStacktrace(lvl zapcore.LevelEnabler) Option {
|
||||
log.addStack = lvl
|
||||
})
|
||||
}
|
||||
|
||||
// IncreaseLevel increase the level of the logger. It has no effect if
|
||||
// the passed in level tries to decrease the level of the logger.
|
||||
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)
|
||||
} else {
|
||||
log.core = core
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user