package fog import ( "io" "os" ) // To allows setting the logging destination writer, defaults to `os.Stdout` if // not provided func To(dest io.Writer) Option { return func(o *options) { o.dest = dest } } // WithLevel sets the verbosity level for the created logger. Passing any negative // value will disable non-Error() logs by setting Zap's log level to Error (2). func WithLevel(lvl int) Option { return func(o *options) { if lvl < 0 { lvl = 2 } o.lvl = int8(toZapLevel(lvl)) } } // private options struct, can only be changed by consumers via the public // Option function interface type options struct { dest io.Writer lvl int8 development bool } func makeOptions(opts ...Option) options { o := options{dest: os.Stdout, development: false} for _, opt := range opts { opt(&o) } return o } // setDevelopment sets the boolean to true so that Zap's development mode can be used func setDevelopment() Option { return func(o *options) { o.development = true } }