Skip to content

Commit

Permalink
feat: allow setting frames to skip
Browse files Browse the repository at this point in the history
useful for wrapper libraries
  • Loading branch information
Crocmagnon committed Feb 24, 2024
1 parent ba2fda1 commit 02e43ea
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions log.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ func NewWithFactory(factory WrapperFactoryFunc) *Logger {
return logger
}

func (l *Logger) SetFramesToSkip(s int) {
l.callerFrameToSkip = s
}

func (l *Logger) RegisterField(fields ...Field) {
l.registeredFieldsMutex.Lock()
defer l.registeredFieldsMutex.Unlock()
Expand Down Expand Up @@ -230,6 +234,10 @@ func ContextWithStackTrace(ctx context.Context, err error) context.Context {
return ctx
}

func SetFramesToSkip(s int) {
global.SetFramesToSkip(s)
}

func RegisterField(fields ...Field) {
global.RegisterField(fields...)
}
Expand Down

0 comments on commit 02e43ea

Please sign in to comment.