#335 caller skip count. (#338)
Go / test (push) Has been cancelled Details
/ autoupdate (push) Successful in 1m21s Details

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
1 changed files with 14 additions and 0 deletions

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
func WithAddStacktrace(v bool) options.Option {
return func(src interface{}) error {