Logging is super difficult to get right for it to provide any value within an application. It’s usually easy to setup, but for it to actually be use

High ROI Python Patterns (Part 1)

submited by
Style Pass
2022-01-17 18:30:21

Logging is super difficult to get right for it to provide any value within an application. It’s usually easy to setup, but for it to actually be useful for the end-user, a developer and/or for debugging purposes is a completely different story. If you were to ask me why this is the case, I’d probably say because it’s up to the developer to accurately describe why something was logged and any context around the logged event.

structlog is one of those Python libraries that has changed my perspective of what logging should be. It forced me to think of logs as “events with context” as supposed to just lines of text prefixed by “[!]”, “[*]”, “[+]” like almost every Infosec tool in existence (Have no clue where this tradition started from, maybe Metasploit?).

Setting up logging with structlog can seem a bit daunting at first but that’s just the price to pay for the amount of flexibility it provides.

Leave a Comment