mirror of
https://gitee.com/johng/gf
synced 2026-06-06 16:21:40 +08:00
improve unit testing case of error logging for ghttp.Server
This commit is contained in:
@ -52,11 +52,11 @@ func Test_Log(t *testing.T) {
|
||||
t.Assert(gstr.Contains(gfile.GetContents(logPath1), "HANDLER"), true)
|
||||
|
||||
logPath2 := gfile.Join(logDir, "access-"+gtime.Now().Format("Ymd")+".log")
|
||||
fmt.Println(gfile.GetContents(logPath2))
|
||||
//fmt.Println(gfile.GetContents(logPath2))
|
||||
t.Assert(gstr.Contains(gfile.GetContents(logPath2), " /hello "), true)
|
||||
|
||||
logPath3 := gfile.Join(logDir, "error-"+gtime.Now().Format("Ymd")+".log")
|
||||
t.Assert(gstr.Contains(gfile.GetContents(logPath3), "[ERRO]"), true)
|
||||
//fmt.Println(gfile.GetContents(logPath3))
|
||||
t.Assert(gstr.Contains(gfile.GetContents(logPath3), "custom error"), true)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user