github.com/rudderlabs/rudder-go-kit@v0.30.0/logger/options.go (about)

     1  package logger
     2  
     3  import "go.uber.org/zap/zapcore"
     4  
     5  // An Option configures a Factory.
     6  type Option interface {
     7  	apply(*Factory)
     8  }
     9  
    10  // optionFunc wraps a func so it satisfies the Option interface.
    11  type optionFunc func(*Factory)
    12  
    13  func (f optionFunc) apply(factory *Factory) {
    14  	f(factory)
    15  }
    16  
    17  // WithClock specifies the clock used by the logger to determine the current
    18  // time for logged entries. Defaults to the system clock with time.Now.
    19  func WithClock(clock zapcore.Clock) Option {
    20  	return optionFunc(func(factory *Factory) {
    21  		factory.config.clock = clock
    22  	})
    23  }