Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var PipelineName = "unknown"
View Source
var SlowQueryLogger = log.StandardLogger()
SlowQueryLogger is used to log slow query, InitLogger will modify it according to config file.
Functions ¶
func GetLogLevelFromEnv ¶
func GetLogLevelFromEnv() string
func InitLogger ¶
func MustInitLogger ¶
func MustInitLogger(cfg *LogConfig)
func SetLogLevelFromEnv ¶
func SetLogLevelFromEnv()
Types ¶
type FileLogConfig ¶
type FileLogConfig struct {
// Filename Log filename, leave empty to disable file log.
Filename string `toml:"filename" json:"filename"`
// LogRotate Is log rotate enabled. TODO.
LogRotate bool `toml:"log-rotate" json:"log-rotate"`
// MaxSize size for a single file, in MB.
MaxSize int `toml:"max-size" json:"max-size"`
// MaxDays log keep days, default is never deleting.
MaxDays int `toml:"max-days" json:"max-days"`
// MaxBackups Maximum number of old log files to retain.
MaxBackups int `toml:"max-backups" json:"max-backups"`
// Compress determines if the rotated log files should be compressed
// using gzip. The default is not to perform compression.
Compress bool `toml:"compress" json:"compress"`
}
FileLogConfig serializes file log related config in toml/json.
type LogConfig ¶
type LogConfig struct {
// Level Log level.
Level string `toml:"level" json:"level"`
// Format Log format. one of json, text, or console.
Format string `toml:"format" json:"format"`
// DisableTimestamp Disable automatic timestamps in output.
DisableTimestamp bool `toml:"disable-timestamp" json:"disable-timestamp"`
// File log config.
File FileLogConfig `toml:"file" json:"file"`
// SlowQueryFile filename, default to File log config on empty.
SlowQueryFile string
}
LogConfig serializes log related config in toml/json.
type TestHook ¶
type TestHook struct{}
func (*TestHook) Fire ¶
Fire implements logrus.Hook interface https://github.com/sirupsen/logrus/issues/63
Click to show internal directories.
Click to hide internal directories.