Hacker News new | past | comments | ask | show | jobs | submit login

This is very long (but thorough!) article about implementing structured logging.

Shorter version: Use structured logging!

If using Python, use `structlog`: https://www.structlog.org/en/stable/




You always need some boilerplate to get structlog working. I always use this (author) to have the needed defaults https://github.com/peakiq/logma.


I agree, structlog is such a quality of life improvement.

It can be tricky to forward all logs through it [0] but it's definitely worth it.

[0] https://www.structlog.org/en/stable/standard-library.html


https://github.com/jteppinette/python-logfmter

I made this library to make global structured logging in Python super easy.


Thank you so much for posting this. Very well designed library. I wish logging worked like this on every language.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: