Description
Go version
go version go1.23.1 linux/amd64
Output of go env
in your module/workspace:
Not relevant
What did you do?
Implement a custom handler for the log/slog package. My custom handler requires access to the source location (file and line) of log entries for detailed logging.
What did you see happen?
The source method in slog.Record is not exported, meaning it’s inaccessible to custom handlers. As a result, I had to re-implement logic to retrieve source location information, which led to redundant code and reduced consistency with Go's built-in logging behavior.
What did you expect to see?
Expected an accessible Source method in slog.Record that allows custom handlers to retrieve source location information without re-implementing the existing internal logic. This would simplify the creation of custom handlers and ensure consistent behavior when accessing log entry sources.
Metadata
Metadata
Assignees
Type
Projects
Status
Incoming
Activity