Documentation ¶
Index ¶
- Constants
- func GetAtomicLevel(level string) zap.AtomicLevel
- func NewApplicationLogger(zapLogger *zap.Logger) application.Logger
- func NewZapLogger(cfg *ModuleConfig) *zap.Logger
- type Config
- type ConfigBuilder
- type ModuleConfig
- func (l *ModuleConfig) EncoderConfig() encoder.Config
- func (s *ModuleConfig) InitConfig(config application.Config) error
- func (l *ModuleConfig) IsDebug() bool
- func (s *ModuleConfig) ProvidedServices() []interface{}
- func (l *ModuleConfig) SetAppNam(appName string) error
- func (l *ModuleConfig) SetLevel(level string) error
- func (l *ModuleConfig) SetLoggerType(loggerType string) error
Constants ¶
View Source
const ( DebugLevel = "debug" InfoLevel = "info" WarningLevel = "warn" ErrorLevel = "error" FatalLevel = "fatal" )
View Source
const ( ConsoleType = "console" JsonType = "json" )
Variables ¶
This section is empty.
Functions ¶
func GetAtomicLevel ¶
func GetAtomicLevel(level string) zap.AtomicLevel
func NewApplicationLogger ¶
func NewApplicationLogger(zapLogger *zap.Logger) application.Logger
func NewZapLogger ¶
func NewZapLogger(cfg *ModuleConfig) *zap.Logger
Types ¶
type Config ¶
type Config struct { // Level is the minimum enabled logging level. Note that this is a dynamic Level zap.AtomicLevel `json:"level" yaml:"level"` // Sampling sets a sampling policy. A nil SamplingConfig disables sampling. Sampling *zap.SamplingConfig `json:"sampling" yaml:"sampling"` // EncoderConfig sets options for the chosen encoder. EncoderConfig encoder.Config `json:"encoderConfig" yaml:"encoderConfig"` // OutputPaths is a list of URLs or file paths to write logging output to. OutputPaths []string `json:"outputPaths" yaml:"outputPaths"` // ErrorOutputPaths is a list of URLs to write internal logger errors to. ErrorOutputPaths []string `json:"errorOutputPaths" yaml:"errorOutputPaths"` // InitialFields is a collection of fields to add to the root logger. InitialFields []zapcore.Field `json:"initialFields" yaml:"initialFields"` EncoderConstructor func(interface{}) (zapcore.Encoder, error) }
type ConfigBuilder ¶
type ModuleConfig ¶
type ModuleConfig struct {
// contains filtered or unexported fields
}
func NewModuleConfig ¶
func NewModuleConfig(encoderConfig *encoder.Config) *ModuleConfig
NewModuleConfig set nil to encoderConfig to use default encoding settings
func (*ModuleConfig) EncoderConfig ¶
func (l *ModuleConfig) EncoderConfig() encoder.Config
func (*ModuleConfig) InitConfig ¶
func (s *ModuleConfig) InitConfig(config application.Config) error
func (*ModuleConfig) IsDebug ¶
func (l *ModuleConfig) IsDebug() bool
func (*ModuleConfig) ProvidedServices ¶
func (s *ModuleConfig) ProvidedServices() []interface{}
func (*ModuleConfig) SetAppNam ¶
func (l *ModuleConfig) SetAppNam(appName string) error
func (*ModuleConfig) SetLevel ¶
func (l *ModuleConfig) SetLevel(level string) error
func (*ModuleConfig) SetLoggerType ¶
func (l *ModuleConfig) SetLoggerType(loggerType string) error
Click to show internal directories.
Click to hide internal directories.