Log Levels and Attributes
Add context to logs.
Adding Context to Logs
A bare message tells you what happened; attributes tell you the details that make logs actionable: which user, which request, how long it took.
The Four Levels
slog levels, lowest to highest severity:
Debug(-4)Info(0)Warn(4)Error(8)
Levels are integers, so you can define custom ones in between.
All lessons in this course
- Why Structured Logs
- slog Handlers
- Log Levels and Attributes
- Custom Handlers