package clog import ( "io" "os" ) type Option func(*options) // To allows setting the logging destination writer, defaults to `os.Stderr` if // not provided func To(dest io.Writer) Option { return func(o *options) { o.dest = dest } } // WithLevel sets the verbosity level (V-level) for the created logr.Logger func WithLevel(lvl int) Option { return func(o *options) { o.lvl = lvl } } // WithCaller configures which [MessageClass] logs get caller information. func WithCaller(c MessageClass) Option { return func(o *options) { o.logCaller = c } } // private options struct, can only be changed by consumers via the public // Option function interface type options struct { dest io.Writer lvl int logCaller MessageClass } func makeOptions(opts ...Option) options { o := options{dest: os.Stderr, logCaller: Error} for _, opt := range opts { opt(&o) } return o }