Re:Logging in Python like a pro
by seabrookmx on Friday July 01, 2022 @01:55PM
(#31950160)
structlog
[ Parent
| on HN ]
You always need some boilerplate to get structlog working. I always use this (author) to have the needed defaults https://github.com/peakiq/logma.
Re:Logging in Python like a pro
by raverbashing on Friday July 01, 2022 @03:47PM
(#31951780)
Yeah, it exists
But IMO it inherited most of loggers problems while not offering a better interface
It is basically a kwargs to json or 'key=value' converter
(Also json logs are overrated. There I said it. Especially one key per line, please don't)
Re:Logging in Python like a pro
by seabrookmx on Saturday July 02, 2022 @01:02PM
(#31960657)
They're quite powerful if you aggregate in a tool like Splunk, ES, or GCloud logging.
You need good quality logs though. Because noisy useless JSON logs are even more noisy and useless.
Agreed on the one key per line bit.
Re:Logging in Python like a pro
by funstuff007 on Friday July 01, 2022 @09:57PM
(#31955346)
agreed. one key per line is straight up madness. in general, your logs should not go out of their way to break grep.