Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultConfig is the default configuration used for the zap-based Logger DefaultConfig = &zap.Config{ Level: zap.NewAtomicLevelAt(zap.InfoLevel), Development: false, DisableCaller: false, DisableStacktrace: false, Sampling: nil, Encoding: "console", EncoderConfig: zapcore.EncoderConfig{ MessageKey: "msg", LevelKey: "lvl", EncodeLevel: zapcore.CapitalColorLevelEncoder, }, OutputPaths: []string{"stdout"}, ErrorOutputPaths: nil, InitialFields: map[string]interface{}{ "date": time.Now().Format(time.RFC3339), }, } )
Functions ¶
Types ¶
type Logger ¶
type Logger struct { // Logger embeds a pointer zap.SugaredLogger to assume its' API *zap.SugaredLogger // contains filtered or unexported fields }
Logger is a type alias to Uber's zap logger, saving us from importing zap everywhere and assuming the SugaredLogger's API results low effort logs later
type Option ¶
Option is a utility function which is called during Logger initialization to alter or even override the DefaultConfig
func WithCustomConfig ¶
WithCustomConfig overrides the entire DefaultConfig configuration, replacing the reference with a new zap.Config object which will be used to configure the Logger
func WithDevelopment ¶
func WithDevelopment() Option
WithDevelopment configures the new Logger for use within development contexts
func WithEncoder ¶
func WithEncoder(encoder zapcore.EncoderConfig) Option
WithEncoder configures a custom Encoder for the new Logger
Click to show internal directories.
Click to hide internal directories.