Comment

Comment by haiku2077

Best advice I ever got on logging:

    log all major logical branches within code (if/for)
    if "request" span multiple machine in cloud infrastructure, include request ID in all so logs can be grouped
    if possible make log level dynamically controlled, so grug can turn on/off when need debug issue (many!)
    if possible make log level per user, so can debug specific user issue
- https://grugbrain.dev/

The only one I'll add is: If your logs are usually read in a log aggregator like Splunk or Grafana instead of in a console or text file, log as JSON objects instead of lines of text. It makes searches easier.

parent haiku2077 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton