2020-02-29 03:31:59 +03:00
|
|
|
package logger
|
|
|
|
|
2020-03-26 01:00:43 +03:00
|
|
|
import (
|
2021-01-10 18:56:39 +03:00
|
|
|
"context"
|
2020-03-26 01:00:43 +03:00
|
|
|
"testing"
|
|
|
|
)
|
2020-02-29 03:31:59 +03:00
|
|
|
|
|
|
|
func TestLogger(t *testing.T) {
|
2021-01-10 18:56:39 +03:00
|
|
|
ctx := context.TODO()
|
2020-02-29 03:31:59 +03:00
|
|
|
l := NewLogger(WithLevel(TraceLevel))
|
2020-11-04 00:38:12 +03:00
|
|
|
if err := l.Init(); err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
2021-01-10 18:56:39 +03:00
|
|
|
l.Trace(ctx, "trace_msg1")
|
|
|
|
l.Warn(ctx, "warn_msg1")
|
|
|
|
l.Fields(map[string]interface{}{"error": "test"}).Info(ctx, "error message")
|
|
|
|
l.Warn(ctx, "first", " ", "second")
|
2020-02-29 03:31:59 +03:00
|
|
|
}
|