2021-03-30 22:46:33 +00:00
|
|
|
package logger
|
|
|
|
|
|
|
|
import "go.uber.org/zap"
|
|
|
|
|
2021-05-13 12:22:03 +00:00
|
|
|
// WithSamplingInitial returns Option that sets sampling initial parameter.
|
2021-03-30 22:46:33 +00:00
|
|
|
func WithSamplingInitial(v int) Option { return func(o *options) { o.SamplingInitial = v } }
|
|
|
|
|
2021-05-13 12:22:03 +00:00
|
|
|
// WithSamplingThereafter returns Option that sets sampling thereafter parameter.
|
2021-03-30 22:46:33 +00:00
|
|
|
func WithSamplingThereafter(v int) Option { return func(o *options) { o.SamplingThereafter = v } }
|
|
|
|
|
2021-05-13 12:22:03 +00:00
|
|
|
// WithFormat returns Option that sets format parameter.
|
2021-03-30 22:46:33 +00:00
|
|
|
func WithFormat(v string) Option { return func(o *options) { o.Format = v } }
|
|
|
|
|
2021-05-13 12:22:03 +00:00
|
|
|
// WithLevel returns Option that sets Level parameter.
|
2021-03-30 22:46:33 +00:00
|
|
|
func WithLevel(v string) Option { return func(o *options) { o.Level = v } }
|
|
|
|
|
2021-05-13 12:22:03 +00:00
|
|
|
// WithTraceLevel returns Option that sets trace level parameter.
|
2021-03-30 22:46:33 +00:00
|
|
|
func WithTraceLevel(v string) Option { return func(o *options) { o.TraceLevel = v } }
|
|
|
|
|
2021-05-13 12:22:03 +00:00
|
|
|
// WithoutDisclaimer returns Option that disables disclaimer.
|
2021-03-30 22:46:33 +00:00
|
|
|
func WithoutDisclaimer() Option { return func(o *options) { o.NoDisclaimer = true } }
|
|
|
|
|
2021-05-13 12:22:03 +00:00
|
|
|
// WithoutCaller returns Option that disables caller printing.
|
2021-03-30 22:46:33 +00:00
|
|
|
func WithoutCaller() Option { return func(o *options) { o.NoCaller = true } }
|
|
|
|
|
2021-05-13 12:22:03 +00:00
|
|
|
// WithAppName returns Option that sets application name.
|
2021-03-30 22:46:33 +00:00
|
|
|
func WithAppName(v string) Option { return func(o *options) { o.AppName = v } }
|
|
|
|
|
2021-05-13 12:22:03 +00:00
|
|
|
// WithAppVersion returns Option that sets application version.
|
2021-03-30 22:46:33 +00:00
|
|
|
func WithAppVersion(v string) Option { return func(o *options) { o.AppVersion = v } }
|
|
|
|
|
2021-05-13 12:22:03 +00:00
|
|
|
// WithZapOptions returns Option that sets zap logger options.
|
2021-03-30 22:46:33 +00:00
|
|
|
func WithZapOptions(opts ...zap.Option) Option { return func(o *options) { o.Options = opts } }
|