[Python-ideas] Logging Levels
Mike Miller
python-ideas at mgmiller.net
Wed Nov 29 12:09:11 EST 2017
Hi,
As mentioned, using logging everywhere has some advantages. It doesn't have to
be added later on, and it avoided a decent fraction of the work porting to
Python 3. Have found users tend to like the labeling of messages, from INFO to
ERROR. We skip the time stamp on the console and send to stdout.
And with a new-file template, it isn't a burden to set it and argparse up in new
scripts. (--verbose etc)
-Mike
On 2017-11-28 20:45, Nick Coghlan wrote:
> On 29 November 2017 at 06:46, Mike Miller <python-ideas at mgmiller.net> wrote:
>> Hi, the reason I use note is that I want it to be output by default. So it
>> must be above warning, or perhaps the default level changed.
>
> If the message to be displayed is part of the actual UX of a command
> line tool, our advice is "You don't want the logging module, you want
> the print() builtin":
> https://docs.python.org/3/howto/logging.html#when-to-use-logging
>
> As a relevant technical detail, it's also worth noting that the
> default handler emits messages on stderr, while CLI UX messages should
> generally be displayed on stdout.
>
> Cheers,
> Nick.
>
More information about the Python-ideas
mailing list