Follow

Today’s “invention”: a Handler for Python’s `logging` that logs to either stdout or stderr based on the log record’s level

github.com/NickKaramoff/Double

Pretty sure there already exists a solution, but I couldn’t find any 🤷‍♂️

@NickKaramoff May I ask why do you need to print logs to different streams depending on the level? I think all (or at least most of) logs should go to stderr

@yyp well, IMO, stderr is for errors (and warnings).

Even when I want to tell user something, that isn't very important (like "Doing X...", "Finished Y"), I still want to log it. I do it to the file as well as to the console, but if the user doesn't care, he can simply do `program > /dev/null` and only receive the error output, without me needing to maintain a CLI option for "quiet" or "verbosity"

Sign in to participate in the conversation
Fosstodon

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.