Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LogConfig ¶
type LogConfig struct { // Level is the log level to log at Level string // ConsoleEnabled enable console logging ConsoleEnabled bool // ConsoleJson is a flag to output log messages in json format ConsoleJson bool // FileEnabled enable file logging FileEnabled bool // FileJson is a flag to output log messages in json format FileJson bool // Directory to log to when filelogging is enabled Directory string // Filename is the name of the logfile which will be placed inside the directory Filename string // MaxSize the max size in MB of the logfile before it's rolled MaxSize int // MaxBackups the max number of rolled files to keep MaxBackups int // MaxAge the max age in days to keep a logfile MaxAge int }
func LoadEnvForLogger ¶
func LoadEnvForLogger() *LogConfig
func (*LogConfig) ConsoleEncoderConfig ¶
func (c *LogConfig) ConsoleEncoderConfig() zapcore.EncoderConfig
func (*LogConfig) FileEncoderConfig ¶
func (c *LogConfig) FileEncoderConfig() zapcore.EncoderConfig
func (*LogConfig) InitLumberjackLogger ¶
func (c *LogConfig) InitLumberjackLogger() lumberjack.Logger
InitLumberjackLogger initialize lumberjack logger. Automatically create log directory if not exists. This will roll the log file when it reaches the max size.
Click to show internal directories.
Click to hide internal directories.