Skip to content

Commit aab8c38

Browse files
louyuexingkevwan
authored andcommitted
chore: Configure "FileTimeFormat" for logging and add test cases.
1 parent eb11521 commit aab8c38

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

core/logx/logs_test.go

+24
Original file line numberDiff line numberDiff line change
@@ -1054,3 +1054,27 @@ type panicStringer struct {
10541054
func (s panicStringer) String() string {
10551055
panic("panic")
10561056
}
1057+
1058+
func TestSetupFileTimeFormat(t *testing.T) {
1059+
testFileTimeFormat := "2006-01-02T15-04-05.000"
1060+
MustSetup(LogConf{
1061+
ServiceName: "any",
1062+
Mode: "file",
1063+
Encoding: "json",
1064+
TimeFormat: timeFormat,
1065+
FileTimeFormat: testFileTimeFormat,
1066+
Path: "./logtest/log",
1067+
Level: "debug",
1068+
//Compress: true,
1069+
KeepDays: 2,
1070+
StackCooldownMillis: 1,
1071+
MaxBackups: 2,
1072+
MaxSize: 1,
1073+
Rotation: "size",
1074+
})
1075+
1076+
for i := 0; i < 10000000; i++ {
1077+
Infof("%stestinfo============================>%d", testFileTimeFormat, i)
1078+
}
1079+
1080+
}

0 commit comments

Comments
 (0)