go logging consideration

tags: learning go programming

content

a few things to keep in mind when implementing logging:

  • logging needs to be structured
    • think about future observability (jsonl)
  • performance
    • logging is expensive, it’s straight-up I/O to stdout, stderr, and disk
    • logging should be async, logging I/O shouldn’t block our current function execution
  • logging middleware
    • use chain-able middleware to capture logs

up

down

reference