From 3df5801078897f4eca1aec6db7ca96caa36b1e70 Mon Sep 17 00:00:00 2001 From: DCjanus Date: Mon, 28 Oct 2024 16:16:17 +0800 Subject: [PATCH] chore(log): add test case for Helper.Logger() --- log/helper_test.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/log/helper_test.go b/log/helper_test.go index 750710c2d81..c056fd88a0e 100644 --- a/log/helper_test.go +++ b/log/helper_test.go @@ -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") @@ -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) {