You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
synctv/internal/conf/log.go

24 lines
925 B
Go

package conf
type LogConfig struct {
Enable bool `yaml:"enable" lc:"enable log to file (default: true)" env:"LOG_ENABLE"`
LogFormat string `yaml:"log_format" lc:"log format, can be set: text | json (default: text)" env:"LOG_FORMAT"`
FilePath string `yaml:"file_path" lc:"log file path (default: log/log.log)" env:"LOG_FILE_PATH"`
MaxSize int `yaml:"max_size" lc:"max size per log file (default: 10 megabytes)" env:"LOG_MAX_SIZE"`
MaxBackups int `yaml:"max_backups" lc:"max backups (default: 10)" env:"LOG_MAX_BACKUPS"`
MaxAge int `yaml:"max_age" lc:"max age (default: 28 days)" env:"LOG_MAX_AGE"`
Compress bool `yaml:"compress" lc:"compress (default: false)" env:"LOG_COMPRESS"`
}
func DefaultLogConfig() LogConfig {
return LogConfig{
Enable: true,
LogFormat: "text",
FilePath: "log/log.log",
MaxSize: 10,
MaxBackups: 10,
MaxAge: 28,
Compress: false,
}
}