Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface { // logur interface logur.Logger // logur context aware interface logur.LoggerContext // go-cloud interface requestlog.Logger // WithFields interface extensions WithFields(fields map[string]interface{}) Logger // WithError interface extensions WithError(err error) Logger }
Logger logx interface
type Options ¶
type Options struct { // Development configures the logger to use a Zap development config // (stacktraces on warnings, no sampling), otherwise a Zap production // config will be used (stacktraces on errors, sampling). Development bool // Encoder configures how Zap will encode the output. Defaults to // console when Development is true and JSON otherwise Encoder zapcore.Encoder // DestWritter controls the destination of the log output. Defaults to // os.Stderr. DestWritter io.Writer // Level configures the verbosity of the logging. Defaults to Debug when // Development is true and Info otherwise Level zapcore.LevelEnabler // StacktraceLevel is the level at and above which stacktraces will // be recorded for all messages. Defaults to Warn when Development // is true and Error otherwise StacktraceLevel zapcore.LevelEnabler // ZapOpts allows passing arbitrary zap.Options to configure on the // underlying Zap logger. ZapOpts []zap.Option }
Options contains all possible settings
func (*Options) BindFlags ¶
BindFlags will parse the given flagset for zap option flags and set the log options accordingly
zap-devel: Development Mode defaults(encoder=consoleEncoder,logLevel=Debug,stackTraceLevel=Warn) Production Mode defaults(encoder=jsonEncoder,logLevel=Info,stackTraceLevel=Error) log-encoder: Zap log encoding ('json' or 'console') log-level: Zap Level to configure the verbosity of logging. Can be one of 'debug', 'info', 'error', or any integer value > 0 which corresponds to custom debug levels of increasing verbosity") stacktrace-level: Zap Level at and above which stacktraces are captured (one of 'warn' or 'error')
type Opts ¶
type Opts func(*Options)
Opts allows to manipulate Options
func UseFlagOptions ¶
UseFlagOptions configures the logger to use the Options set by parsing zap option flags from the CLI.
opts := zap.Options{} opts.BindFlags(flag.CommandLine) log := zap.New(zap.UseFlagOptions(&opts))
Click to show internal directories.
Click to hide internal directories.