Skip to content

Commit a1ebd06

Browse files
Header comments fixed for godoc
1 parent d17d9c9 commit a1ebd06

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

pkg/log/zap/zap.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,13 @@ func NewRaw(opts ...Opts) *zap.Logger {
209209
return log
210210
}
211211

212-
// BindToFlagSet func allows CLI passed flags to be parsed.
212+
// BindFlags will parse the given flagset for zap option flags and set the log options accordingly
213+
// zap-devel: Development Mode defaults(encoder=consoleEncoder,logLevel=Debug,stackTraceLevel=Warn)
214+
// Production Mode defaults(encoder=jsonEncoder,logLevel=Info,stackTraceLevel=Error)
215+
// zap-encoder: Zap log encoding ('json' or 'console')
216+
// zap-log-level: Zap Level to configure the verbosity of logging. Can be one of 'debug', 'info', 'error',
217+
// or any integer value > 0 which corresponds to custom debug levels of increasing verbosity")
218+
// zap-stacktrace-level: Zap Level at and above which stacktraces are captured (one of 'warn' or 'error')
213219
func (o *Options) BindFlags(fs *flag.FlagSet) {
214220

215221
// Set Development mode value
@@ -242,7 +248,10 @@ func (o *Options) BindFlags(fs *flag.FlagSet) {
242248
"Zap Level at and above which stacktraces are captured (one of 'warn' or 'error')")
243249
}
244250

245-
// UseFlagOptions to set logger with CLI passed flags.
251+
// UseFlagOptions configures the logger to use the Options set by parsing zap option flags from the CLI.
252+
// opts := zap.Options{}
253+
// opts.BindFlags(flag.CommandLine)
254+
// log := zap.New(zap.UseFlagOptions(&opts))
246255
func UseFlagOptions(in *Options) Opts {
247256
return func(o *Options) {
248257
*o = *in

0 commit comments

Comments
 (0)