Documentation ¶
Overview ¶
Package logstd contains utilities for standardizing logging across different apps at Fensak.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLogger ¶
GetLogger returns the zap logger object. This can be used to customize the logger object.
func GetSugaredLogger ¶
func GetSugaredLogger(c *Logger) *zap.SugaredLogger
GetSugaredLogger returns the zap sugared logger which can be used to emit log messages from the app.
func GetSugaredLoggerWithoutConfig ¶
func GetSugaredLoggerWithoutConfig() (*zap.SugaredLogger, error)
GetSugardLoggerWithoutConfig returns a generic zap sugared logger without configuration. This is useful for emitting log messages before the initialization stage.
func GetTestSugaredLogger ¶
func GetTestSugaredLogger() *zap.SugaredLogger
GetTestLogger returns the zap sugared logger which can be used during testing.
func GetZapConfig ¶
GetZapConfig returns the configuration for zap.
Types ¶
type Logger ¶
type Logger struct { Level string `mapstructure:"level"` OutputPaths []string `mapstructure:"outputpaths"` Encoding string `mapstructure:"encoding"` // contains filtered or unexported fields }
Logger represents configuration options for the zap logger. If this is not set in the config, defaults to a logger optimized for production use. This can be embedded in a viper compatible config struct.
func NewLoggerCfgForTest ¶
func NewLoggerCfgForTest() *Logger
NewLoggerCfgForTest returns a logging configuration that is optimized for use in a testing environment.