#335 caller skip count. (#338)
Some checks failed
Go / test (push) Has been cancelled
/ autoupdate (push) Failing after 5s

Co-authored-by: Gorbunov Kirill Andreevich <kgorbunov@mtsbank.ru>
Reviewed-on: #338
Co-authored-by: Кирилл Горбунов <kirya_gorbunov_2015@mail.ru>
Co-committed-by: Кирилл Горбунов <kirya_gorbunov_2015@mail.ru>
This commit is contained in:
Кирилл Горбунов 2024-04-15 13:31:14 +03:00 committed by Василий Толстов
parent b8928d3da9
commit 725ed992cc

View File

@ -214,6 +214,20 @@ func WithMicroKeys() 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 {
return err
}
if err = options.Set(src, c.(int)+n, ".CallerSkipCount"); err != nil {
return err
}
return nil
}
}
// WithAddStacktrace controls writing stacktrace on error // WithAddStacktrace controls writing stacktrace on error
func WithAddStacktrace(v bool) options.Option { func WithAddStacktrace(v bool) options.Option {
return func(src interface{}) error { return func(src interface{}) error {