From c31de2df7d6a8b39833cf90768a395f9502ba531 Mon Sep 17 00:00:00 2001 From: JellyTony Date: Tue, 10 Oct 2023 01:23:48 +0800 Subject: [PATCH] fix(logging): fix callerSkipOffset change 1 --- logging_test.go | 4 +++- options.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/logging_test.go b/logging_test.go index c25624e..fadd0a7 100644 --- a/logging_test.go +++ b/logging_test.go @@ -42,7 +42,9 @@ func TestLogging_WithContext(t *testing.T) { t.Logf("trace_id: %s", spanContext.TraceID().String()) t.Logf("span_id: %s", spanContext.SpanID().String()) - logging.WithContext(ctx).Info("TestDefault_WithContext") + logging.WithContext(ctx).WithFields(map[string]any{ + "11": 222, + }).Info("TestDefault_WithContext") } func TestLogging_WithFields(t *testing.T) { diff --git a/options.go b/options.go index 8161e36..09a7e35 100644 --- a/options.go +++ b/options.go @@ -10,7 +10,7 @@ const ( spanKey = "span_id" traceKey = "trace_id" - callerSkipOffset = 2 + callerSkipOffset = 1 fileMode = "file" consoleMode = "console"