改进 日志格式
This commit is contained in:
parent
56d9f01640
commit
4695cc5c04
13
main.go
13
main.go
@ -126,9 +126,16 @@ func GetPath(includeFileName bool, year int, month time.Month, day int, namespac
|
||||
// month to int
|
||||
|
||||
monthNumber := int(month)
|
||||
if includeFileName {
|
||||
return fmt.Sprintf("%s/%s/%d-%d/%d/%s-%s.log", config.Dir.Dir, namespace, year, monthNumber, day, containerName, stream)
|
||||
|
||||
var m string
|
||||
|
||||
if monthNumber < 10 {
|
||||
m = fmt.Sprintf("0%d", monthNumber)
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s/%s/%d-%d/%d/", config.Dir.Dir, namespace, year, monthNumber, day)
|
||||
if includeFileName {
|
||||
return fmt.Sprintf("%s/%s/%d-%s/%d/%s-%s.log", config.Dir.Dir, namespace, year, m, day, containerName, stream)
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s/%s/%d-%s/%d/", config.Dir.Dir, namespace, year, m, day)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user