From a9426dfea54473d70fcfe18b36f88f1b1b0af1ed Mon Sep 17 00:00:00 2001 From: Gorbunov Kirill Andreevich Date: Sun, 14 Apr 2024 17:06:23 +0300 Subject: [PATCH] #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 + } +}