2020-02-29 03:31:59 +03:00
|
|
|
package logger
|
|
|
|
|
2020-03-26 01:00:43 +03:00
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
2020-02-29 03:31:59 +03:00
|
|
|
|
|
|
|
func TestLogger(t *testing.T) {
|
|
|
|
l := NewLogger(WithLevel(TraceLevel))
|
2020-03-03 11:07:38 +03:00
|
|
|
h1 := NewHelper(l).WithFields(map[string]interface{}{"key1": "val1"})
|
|
|
|
h1.Trace("trace_msg1")
|
|
|
|
h1.Warn("warn_msg1")
|
|
|
|
|
|
|
|
h2 := NewHelper(l).WithFields(map[string]interface{}{"key2": "val2"})
|
|
|
|
h2.Trace("trace_msg2")
|
|
|
|
h2.Warn("warn_msg2")
|
|
|
|
|
2020-04-26 17:11:53 +03:00
|
|
|
l.Fields(map[string]interface{}{"key3": "val4"}).Log(InfoLevel, "test_msg")
|
2020-02-29 03:31:59 +03:00
|
|
|
}
|