|
|
@@ -41,6 +41,7 @@ func (suite *ZeroLoggerTestSuite) TestLog() {
|
|
41
|
41
|
testData := map[string]func(mtglib.Logger){
|
|
42
|
42
|
"info": func(l mtglib.Logger) { l.Info("hello") },
|
|
43
|
43
|
"warn": func(l mtglib.Logger) { l.Warning("hello") },
|
|
|
44
|
+ "printf": func(l mtglib.Logger) { l.Printf("hello") },
|
|
44
|
45
|
"debug": func(l mtglib.Logger) { l.Debug("hello") },
|
|
45
|
46
|
"info-error": func(l mtglib.Logger) { l.InfoError("hello", io.EOF) },
|
|
46
|
47
|
"warn-error": func(l mtglib.Logger) { l.WarningError("hello", io.EOF) },
|
|
|
@@ -64,13 +65,17 @@ func (suite *ZeroLoggerTestSuite) TestLog() {
|
|
64
|
65
|
timestamp := time.Unix(msg.Timestamp/1000, (msg.Timestamp%1000)*1_000_000)
|
|
65
|
66
|
assert.WithinDuration(t, time.Now(), timestamp, 100*time.Millisecond)
|
|
66
|
67
|
|
|
|
68
|
+ if level == "printf" {
|
|
|
69
|
+ level = "debug"
|
|
|
70
|
+ }
|
|
|
71
|
+
|
|
67
|
72
|
assert.Equal(t, level, msg.Level)
|
|
68
|
73
|
assert.Equal(t, name, msg.StrParam)
|
|
69
|
74
|
assert.EqualValues(t, 1, msg.IntParam)
|
|
70
|
75
|
assert.Equal(t, "name", msg.Logger)
|
|
71
|
76
|
assert.Equal(t, "hello", msg.Message)
|
|
72
|
77
|
|
|
73
|
|
- if level != name {
|
|
|
78
|
+ if level != name && name != "printf" {
|
|
74
|
79
|
assert.Equal(t, io.EOF.Error(), msg.Error)
|
|
75
|
80
|
} else {
|
|
76
|
81
|
assert.Empty(t, msg.Error)
|