undo remove SkipCallerCount
Some checks failed
lint / lint (pull_request) Has been cancelled
pr / test (pull_request) Has been cancelled

This commit is contained in:
2024-10-11 16:48:14 +03:00
parent 4a787dd2c3
commit ced277ff57
3 changed files with 15 additions and 3 deletions

View File

@@ -16,8 +16,6 @@ import (
const (
badKey = "!BADKEY"
// DefaultCallerSkipCount used by logger
defaultCallerSkipCount = 3
)
const emptyMSg = "!EMPTYMSG"
@@ -227,7 +225,7 @@ func (s *slogLogger) printLog(ctx context.Context, lvl logger.Level, msg string,
}
var pcs [1]uintptr
runtime.Callers(defaultCallerSkipCount, pcs[:]) // skip [Callers, printLog, LogLvlMethod]
runtime.Callers(s.opts.CallerSkipCount, pcs[:]) // skip [Callers, printLog, LogLvlMethod]
r := slog.NewRecord(s.opts.TimeFunc(), loggerToSlogLevel(lvl), msg, pcs[0])
r.Add(attrs...)
_ = s.handler.Handle(ctx, r)