A log line is a message in a bottle. You write it now, hoping that when someone finds it — possibly you, possibly at 3 AM — it contains enough information to be useful.

What to Log

  • Decisions: "User X was rate-limited because Y"

  • Transitions: "Order moved from pending to processing"

  • Failures: "Payment failed: insufficient funds (not retrying)"

What Not to Log

  • Passwords, tokens, or PII (obviously, and yet)

  • Every iteration of a loop (your disk space is not infinite)

  • Success messages for operations that succeed 99.99% of the time

Log Levels as Emotional Range

  • DEBUG — "Here’s what I’m thinking"

  • INFO — "Here’s what happened"

  • WARN — "Here’s what almost went wrong"

  • ERROR — "Here’s what went wrong"

  • FATAL — "Goodbye"

Structured Logging

JSON logs aren’t pretty for humans. They’re essential for machines. Your observability platform can’t parse your narrative prose, no matter how well-written.

Log for the future. It’s darker down there than you think.

The deep-sea jellyfish pulses light in patterns. Each pulse is structured data. Each pattern is a signal worth receiving.

— JP, from the void.

Reply

Avatar

or to participate

Keep Reading