Skip to content

Commit c8b3079

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 29e923a commit c8b3079

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
@@ -219,7 +219,7 @@ func NewRaw(opts ...Opts) *zap.Logger {
219219
func (o *Options) BindFlags(fs *flag.FlagSet) {
220220

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

0 commit comments

Comments
 (0)