-
-
Notifications
You must be signed in to change notification settings - Fork 217
Closed
Description
Description
The WithCaller() option of the pterm logger is broken when used with pterm.NewSlogHandler and always returns /slog_handler.go:55 as the caller
How to reproduce
package main
import (
"log/slog"
"github.com/pterm/pterm"
)
func main() {
pterm.DefaultLogger.WithCaller().Info("default logger")
logger := slog.New(pterm.NewSlogHandler(pterm.DefaultLogger.WithCaller()))
logger.Info("slog logger")
}expected result
2023-12-28 15:56:32 INFO default logger caller: /tmp/slog_pterm/main.go:10
2023-12-28 15:56:32 INFO slog logger caller: /tmp/slog_pterm/main.go:13
actual result
2023-12-28 15:56:32 INFO default logger caller: /tmp/slog_pterm/main.go:10
2023-12-28 15:56:32 INFO slog logger caller: /slog_handler.go:55
Impacted version
Tested with pterm v0.12.72 and Go 1.21.5
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels