You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.