Logging

Output Link to heading

Fields Link to heading

  • Timestamp
  • Level name (human-readable) and number (to filter by greater or lesser).
  • Filepath, line number, and function name to locate the source code.
  • Process and thread IDs to debug concurrency issues.

Plaintext vs Structured Link to heading

  • Plaintext
    • pros: most commom; human-readable;
    • cons: hard to parse;
  • Structured
    • pros: easy to parse; easy to search/filter/aggregate;
    • cons: verbose; less human-readable (can be solved by showing only the message);

Structured formats Link to heading

  • logfmt
    • pros: more human-readable; less verbose;
    • cons:
  • JSON
    • pros:
    • cons: less human-readable; more verbose;

Tools Link to heading

Moved to My Toolbox - Logging, Python - Logging, and Django - Logging

References Link to heading