Skip to content

Commit

Permalink
chore: Configure "FileTimeFormat" for logging and add test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
louyuexing authored and kevwan committed Feb 22, 2025
1 parent eb11521 commit aab8c38
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions core/logx/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1054,3 +1054,27 @@ type panicStringer struct {
func (s panicStringer) String() string {
panic("panic")
}

func TestSetupFileTimeFormat(t *testing.T) {
testFileTimeFormat := "2006-01-02T15-04-05.000"
MustSetup(LogConf{
ServiceName: "any",
Mode: "file",
Encoding: "json",
TimeFormat: timeFormat,
FileTimeFormat: testFileTimeFormat,
Path: "./logtest/log",
Level: "debug",
//Compress: true,
KeepDays: 2,
StackCooldownMillis: 1,
MaxBackups: 2,
MaxSize: 1,
Rotation: "size",
})

for i := 0; i < 10000000; i++ {
Infof("%stestinfo============================>%d", testFileTimeFormat, i)
}

}

0 comments on commit aab8c38

Please sign in to comment.