From a9426dfea54473d70fcfe18b36f88f1b1b0af1ed Mon Sep 17 00:00:00 2001 From: Gorbunov Kirill Andreevich Date: Sun, 14 Apr 2024 17:06:23 +0300 Subject: [PATCH 1/2] #335 caller skip count. --- logger/options.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/logger/options.go b/logger/options.go index c0335316..3018121f 100644 --- a/logger/options.go +++ b/logger/options.go @@ -176,3 +176,16 @@ func WithMicroKeys() options.Option { return nil } } + +func WithIncCallerSkipCount(n int) options.Option { + return func(src interface{}) error { + c, err := options.Get(src, ".CallerSkipCount") + if err != nil { + return err + } + if err = options.Set(src, c.(int)+n, ".CallerSkipCount"); err != nil { + return err + } + return nil + } +} -- 2.45.2 From d5fdbefa49454b60609e34635da0187f08caa181 Mon Sep 17 00:00:00 2001 From: Gorbunov Kirill Andreevich Date: Mon, 15 Apr 2024 13:21:43 +0300 Subject: [PATCH 2/2] #335 change name options --- logger/options.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/logger/options.go b/logger/options.go index 5ad9145f..d3748749 100644 --- a/logger/options.go +++ b/logger/options.go @@ -214,7 +214,8 @@ func WithMicroKeys() options.Option { } } -func WithIncCallerSkipCount(n int) options.Option { +// WithAddCallerSkipCount add skip count for copy logger +func WithAddCallerSkipCount(n int) options.Option { return func(src interface{}) error { c, err := options.Get(src, ".CallerSkipCount") if err != nil { -- 2.45.2