Agent skill · elithrar
logging-sucks
Use when adding, refactoring, or reviewing logging code and callsites across a codebase. Ensures structured, queryable, context-rich logging.
What it needs
About 4k tokens when loaded.
What this skill does
This skill is adapted from "Logging sucks. And here's how to make it better." by Boris Tane. When helping with logging, observability, or debugging strategies, first identify the current logger, transport, schema, and deployment/runtime constraints. Then follow these principles: Core Philosophy Logs are optimized for querying, not writing — always design with debugging in mind Context is everything — a log without correlation IDs is useless in distributed systems Logs are for humans during incidents, not just for compliance or "just in case" If you can't filter and search your logs effectively, they provide zero value Mental model shift: Log what happened to this request, not what your code is doing Wide Events / Canonical Log Lines Instead of scattering 10-20 log lines throughout a request, emit one comprehensive event per request per service. This is the most important concept for effective logging. Build the event object throughout the request lifecycle Enrich it with context as you process (user info, business data, feature flags) Emit once at the end with all context attached Include 30-50+ fields containing everything useful for debugging Example wide event structure: This enables queries like: "Show all checkout failures for premium users where newcheckoutflow was enabled, grouped by error code." Structured Logging Requirements Always use key-value pairs (JSON) instead of string interpolation Bad: "Payment failed for user 123" Good: {"event": "paymentfailed", "userid": "123", "reason": "insufficientfunds", "amount": 99.99} Structured logs are machine-parseable, enabling aggregation, alerting, and dashboards Required Fields for Every Log Event timestamp — RFC3339 with timezone (e.g., 2025-01-24T20:00:00Z) level — debug, info, warn, error (be consistent, don't invent new levels) event — machine-readable event name, snakecase (e.g., userloginsuccess) requestid or traceid — for correlating logs across a single request service — which service/application emitted t …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills elithrar/logging-sucks