Skip to content

Commit

Permalink
change callers for near slog realization
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Okhlopkov <[email protected]>
  • Loading branch information
Pavel Okhlopkov committed Oct 22, 2024
1 parent 37e70be commit a4d9751
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/unilogger/slog.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ func (h *SlogHandler) Handle(ctx context.Context, r slog.Record) error {

isCustom := logContext.GetCustomKeyContext(ctx)
if isCustom {
r.PC, _, _, _ = runtime.Caller(4)
var pc uintptr
var pcs [1]uintptr
// skip [runtime.Callers, this function, this function's caller]
runtime.Callers(4, pcs[:])
pc = pcs[0]
r.PC = pc

tracePtr = logContext.GetStackTraceContext(ctx)
}
Expand Down

0 comments on commit a4d9751

Please sign in to comment.