Skip to content

Commit

Permalink
chore(log): add test case for Helper.Logger()
Browse files Browse the repository at this point in the history
  • Loading branch information
DCjanus committed Oct 28, 2024
1 parent 2dcf06b commit 9fa2ffb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion log/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import (
)

func TestHelper(_ *testing.T) {
logger := With(DefaultLogger, "ts", DefaultTimestamp, "caller", DefaultCaller)
logger := With(
DefaultLogger,
"ts", DefaultTimestamp,
"caller", DefaultCaller,
"module", "test",
)
log := NewHelper(logger)

log.Log(LevelDebug, "msg", "test debug")
Expand All @@ -19,6 +24,12 @@ func TestHelper(_ *testing.T) {
log.Warn("test warn")
log.Warnf("test %s", "warn")
log.Warnw("log", "test warn")

subLogger := With(log.Logger(),
"module", "sub",
)
subLog := NewHelper(subLogger)
subLog.Infof("sub logger test with level %s", "info")
}

func TestHelperWithMsgKey(_ *testing.T) {
Expand Down

0 comments on commit 9fa2ffb

Please sign in to comment.