Skip to content

Commit 20e3bd4

Browse files
committed
Default zap dev flag to options value
This defaults the value of `--zap-devel` to whatever is in the options struct. This allows programs to set a "prefered" default. Since folks would already be passing an empty options struct, this shouldn't affect any existing users (famous last words).
1 parent be18097 commit 20e3bd4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/log/zap/zap.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func NewRaw(opts ...Opts) *zap.Logger {
220220
func (o *Options) BindFlags(fs *flag.FlagSet) {
221221

222222
// Set Development mode value
223-
fs.BoolVar(&o.Development, "zap-devel", false,
223+
fs.BoolVar(&o.Development, "zap-devel", o.Development,
224224
"Development Mode defaults(encoder=consoleEncoder,logLevel=Debug,stackTraceLevel=Warn). "+
225225
"Production Mode defaults(encoder=jsonEncoder,logLevel=Info,stackTraceLevel=Error)")
226226

0 commit comments

Comments
 (0)