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 authored and fsamin committed Feb 26, 2024
1 parent ba2fda1 commit d335794
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions log.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ func NewWithFactory(factory WrapperFactoryFunc) *Logger {
return logger
}

func (l *Logger) GetFramesToSkip() int {
return l.callerFrameToSkip
}

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 +238,14 @@ func ContextWithStackTrace(ctx context.Context, err error) context.Context {
return ctx
}

func GetFramesToSkip() int {
return global.GetFramesToSkip()
}

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

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

0 comments on commit d335794

Please sign in to comment.