Skip to content

Don't log a warning message to stdout

Jonas Strassel requested to merge boredland/pacman-mirrors:feat/logger into master

This replaces a print statement with a logging statement for a warning that is emitted when no LANG etc. settings are present in a system.

Using stdout/regular print statements is not recommended for logging purposes as it is not possible to control the verbosity of the output. And I breaks tools that rely on the stdout to be clean or have a certain format.

In general terms, I'd recommend to use logging in all places where print statements are not used as an API or CLI output.

Ref.: https://docs.python.org/3/howto/logging.html#when-to-use-logging

Edited by Jonas Strassel

Merge request reports