@@ -101,17 +101,19 @@ func newConsoleEncoder(opts ...EncoderConfigOption) zapcore.Encoder {
101
101
return zapcore .NewConsoleEncoder (encoderConfig )
102
102
}
103
103
104
- // Level sets the the minimum enabled logging level e.g Debug, Info
105
- // See Options.Level
104
+ // Level sets Options.Level, which configures the the minimum enabled logging level e.g Debug, Info.
105
+ // A zap log level should be multiplied by -1 to get the logr verbosity.
106
+ // For example, to get logr verbosity of 3, pass zapcore.Level(-3) to this Opts.
107
+ // See https://pkg.go.dev/github.com/go-logr/zapr for how zap level relates to logr verbosity.
106
108
func Level (level zapcore.LevelEnabler ) func (o * Options ) {
107
109
return func (o * Options ) {
108
110
o .Level = level
109
111
}
110
112
}
111
113
112
- // StacktraceLevel configures the logger to record a stack trace for all messages at
113
- // or above a given level.
114
- // See Options.StacktraceLevel
114
+ // StacktraceLevel sets Options.StacktraceLevel, which configures the logger to record a stack trace
115
+ // for all messages at or above a given level.
116
+ // See the Level Opts for the relationship of zap log level to logr verbosity.
115
117
func StacktraceLevel (stacktraceLevel zapcore.LevelEnabler ) func (o * Options ) {
116
118
return func (o * Options ) {
117
119
o .StacktraceLevel = stacktraceLevel
@@ -151,12 +153,16 @@ type Options struct {
151
153
//
152
154
// Deprecated: Use DestWriter instead
153
155
DestWritter io.Writer
154
- // Level configures the verbosity of the logging. Defaults to Debug when
155
- // Development is true and Info otherwise
156
+ // Level configures the verbosity of the logging.
157
+ // Defaults to Debug when Development is true and Info otherwise.
158
+ // A zap log level should be multiplied by -1 to get the logr verbosity.
159
+ // For example, to get logr verbosity of 3, set this field to zapcore.Level(-3).
160
+ // See https://pkg.go.dev/github.com/go-logr/zapr for how zap level relates to logr verbosity.
156
161
Level zapcore.LevelEnabler
157
162
// StacktraceLevel is the level at and above which stacktraces will
158
163
// be recorded for all messages. Defaults to Warn when Development
159
- // is true and Error otherwise
164
+ // is true and Error otherwise.
165
+ // See Level for the relationship of zap log level to logr verbosity.
160
166
StacktraceLevel zapcore.LevelEnabler
161
167
// ZapOpts allows passing arbitrary zap.Options to configure on the
162
168
// underlying Zap logger.
0 commit comments