文件的时区

This commit is contained in:
Yun
2024-06-27 21:08:49 +08:00
parent 7eb883bf67
commit 3ebbf617de
+5 -5
View File
@@ -19,19 +19,19 @@ func (l *Logger) nowFileName(event string) string {
switch l.option.fileSplit { switch l.option.fileSplit {
case FileSplitTimeA: case FileSplitTimeA:
// (年/月/日/时) // (年/月/日/时)
prefix = fmt.Sprint(time.Now().Local().Format("2006/01/02/15")) // 2006-01-02 15:04:05 prefix = fmt.Sprint(time.Now().In(l.option.timeZone).Format("2006/01/02/15")) // 2006-01-02 15:04:05
case FileSplitTimeB: case FileSplitTimeB:
// (年/月/日) // (年/月/日)
prefix = fmt.Sprint(time.Now().Local().Format("2006/01/02")) // 2006-01-02 15:04:05 prefix = fmt.Sprint(time.Now().In(l.option.timeZone).Format("2006/01/02")) // 2006-01-02 15:04:05
case FileSplitTimeC: case FileSplitTimeC:
// (年/月-日) // (年/月-日)
prefix = fmt.Sprint(time.Now().Local().Format("2006/01-02")) // 2006-01-02 15:04:05 prefix = fmt.Sprint(time.Now().In(l.option.timeZone).Format("2006/01-02")) // 2006-01-02 15:04:05
case FileSplitTimeD: case FileSplitTimeD:
// (年-月-日-时) // (年-月-日-时)
prefix = fmt.Sprint(time.Now().Local().Format("2006-01-02-15")) // 2006-01-02 15:04:05 prefix = fmt.Sprint(time.Now().In(l.option.timeZone).Format("2006-01-02-15")) // 2006-01-02 15:04:05
case FileSplitTimeE: case FileSplitTimeE:
// (年-月-日) // (年-月-日)
prefix = fmt.Sprint(time.Now().Local().Format("2006-01-02")) // 2006-01-02 15:04:05 prefix = fmt.Sprint(time.Now().In(l.option.timeZone).Format("2006-01-02")) // 2006-01-02 15:04:05
} }
if prefix != "" { if prefix != "" {