principleModeratepending
Logging levels -- when to use each one
Viewed 0 times
log levelsERRORWARNINFODEBUGTRACEverbosity
Problem
Every log is at INFO level or console.log. Logs are either too noisy (everything logged) or too quiet (nothing logged when debugging). No way to increase verbosity without code changes.
Solution
Use levels consistently: ERROR: something failed that needs human attention NOW (page ops team). WARN: something is degraded but still working (approaching limits, using fallback). INFO: business-significant events (user signed up, order placed, deploy started). DEBUG: technical details for debugging (query params, response bodies, timing). TRACE: extremely verbose, rarely enabled (function entry/exit). Configure level per environment: production=INFO, staging=DEBUG, dev=DEBUG/TRACE.
Why
Log levels provide a volume knob. In production, you want business events and errors. When debugging, you increase verbosity without deploying new code. This only works if levels are used consistently.
Revisions (0)
No revisions yet.