更新 format.go

log 信息添加category
This commit is contained in:
kingecg 2023-12-10 00:40:28 +08:00
parent bde229321f
commit 5b8be57c69
1 changed files with 2 additions and 2 deletions

View File

@ -4,12 +4,12 @@ import (
"fmt"
)
const logTemplate = "[%s] %s - %s\n"
const logTemplate = "[%s] %s : %s - %s\n"
func format(logEvent LogEvent) string {
data := logEvent.Ts.Format("2006-01-02 15:04:05")
msg := fmt.Sprint(logEvent.Data...)
ret := fmt.Sprintf(logTemplate, data, getLogLevelStr(logEvent.Level), msg)
ret := fmt.Sprintf(logTemplate, data, logEvent.Category getLogLevelStr(logEvent.Level), msg)
return ret
}