diff --git a/config.go b/config.go index 0d262cd..e7e58a5 100644 --- a/config.go +++ b/config.go @@ -35,6 +35,9 @@ type FileLogConfig struct { MaxDays int `toml:"max-days" json:"max-days"` // 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"` } // Config serializes log related config in toml/json. diff --git a/log.go b/log.go index 040ec6d..ce7fd45 100644 --- a/log.go +++ b/log.go @@ -126,6 +126,7 @@ func initFileLog(cfg *FileLogConfig) (*lumberjack.Logger, error) { MaxBackups: cfg.MaxBackups, MaxAge: cfg.MaxDays, LocalTime: true, + Compress: cfg.Compress, }, nil }