#335 caller skip count. #338

Merged
vtolstov merged 3 commits from kgorbunov/micro:#335 into master 2024-04-15 13:31:15 +03:00

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 {