1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-06-18 04:40:03 +02:00

cmd/thalos/main.go: Implement log splitting if file logging is enabled.

This commit is contained in:
Henrik Hautakoski 2023-05-17 10:52:12 +02:00
parent e1c092659a
commit 93e765f14c
2 changed files with 25 additions and 10 deletions

View file

@ -46,8 +46,12 @@ func NewRotatingFile(filename string, maxSize int64, maxAge time.Duration) (*Rot
}, nil
}
func NewRotatingFileFromConfig(config Config) (*RotatingFile, error) {
return NewRotatingFile(config.GetFilePath(), int64(config.MaxFileSize), config.MaxTime)
func NewRotatingFileFromConfig(config Config, suffix string) (*RotatingFile, error) {
if len(suffix) > 0 {
suffix = "_" + suffix
}
return NewRotatingFile(config.GetFilePath()+suffix+".log", int64(config.MaxFileSize), config.MaxTime)
}
func (w *RotatingFile) newFilename(name string) string {