fix log level
This commit is contained in:
parent
65f8590910
commit
4b2bd716b6
@ -69,8 +69,8 @@ func (p *PatternLogFormatter) ToString(lm *LogMsg) string {
|
|||||||
'm': lm.Msg,
|
'm': lm.Msg,
|
||||||
'n': strconv.Itoa(lm.LineNumber),
|
'n': strconv.Itoa(lm.LineNumber),
|
||||||
'l': strconv.Itoa(lm.Level),
|
'l': strconv.Itoa(lm.Level),
|
||||||
't': levelPrefix[lm.Level-1],
|
't': levelPrefix[lm.Level],
|
||||||
'T': levelNames[lm.Level-1],
|
'T': levelNames[lm.Level],
|
||||||
'F': lm.FilePath,
|
'F': lm.FilePath,
|
||||||
}
|
}
|
||||||
_, m['f'] = path.Split(lm.FilePath)
|
_, m['f'] = path.Split(lm.FilePath)
|
||||||
|
|||||||
@ -88,7 +88,7 @@ func TestPatternLogFormatter(t *testing.T) {
|
|||||||
}
|
}
|
||||||
got := tes.ToString(lm)
|
got := tes.ToString(lm)
|
||||||
want := lm.FilePath + ":" + strconv.Itoa(lm.LineNumber) + "|" +
|
want := lm.FilePath + ":" + strconv.Itoa(lm.LineNumber) + "|" +
|
||||||
when.Format(tes.WhenFormat) + levelPrefix[lm.Level-1] + ">> " + lm.Msg
|
when.Format(tes.WhenFormat) + levelPrefix[lm.Level] + ">> " + lm.Msg
|
||||||
if got != want {
|
if got != want {
|
||||||
t.Errorf("want %s, got %s", want, got)
|
t.Errorf("want %s, got %s", want, got)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user