logging levels

18 views
Skip to first unread message

Robert Collins

unread,
May 4, 2015, 11:51:44 PM5/4/15
to pypa...@googlegroups.com
I discussed this with Donald on IRC, but I thought I'd get more input
before doing it.

pip -d currently is /really/ verbose - badly so. We log every single
link we analyse, for instance.

Thats useful for some classes of diagnosis, but its not useful for 'I
want to see just a bit more [e.g. stdout/err from successful setup.py
installs].

I'd like to give us, like -vv a -dd which is the current -d, and -d
which just shows a bit more data without being overwhelming.

the built in levels are:
CRITICAL = 50
ERROR = 40
WARNING = 30
INFO = 20
DEBUG = 10

we map these:
-qq ERROR (and above)
-q WARNING
nothing INFO
-d DEBUG


One way we could do what I'd like is to add a custom level e.g.
TRACE = 5

And then push down a few messages.

Another way would be to raise the default to WARNING and shuffle everything up
-qq CRITICAL
-q ERROR
nothing WARNING
-d INFO
-dd DEBUG

Any objections to the basic idea? And if not, a preferred impl strategy?

-Rob

--
Robert Collins <rbtco...@hp.com>
Distinguished Technologist
HP Converged Cloud

Marcus Smith

unread,
May 5, 2015, 12:47:25 PM5/5/15
to Robert Collins, pypa...@googlegroups.com
"-d"?, don't you mean "-v"?

there used to be 2 more levels in there, but it was compressed out in a logging refactor last year I think

there used to be docs on the mapping of flag count to levels also, but that was removed at some point.
   https://github.com/pypa/pip/blob/1.5.4/docs/reference/pip.rst#console-logging

I'm concerned that the multiple levels of quiet and verbose has created more confusion than value.
do we think anyone uses -q? or -qq?

I think I'd rather have a simple --debug flag and leave at that, possibly, supporting "--debug --debug" for really chatty debugging.

as for simply adding another level, I'm inclined to the TRACE plan you mention.

Jason R. Coombs

unread,
May 5, 2015, 1:16:09 PM5/5/15
to Marcus Smith, Robert Collins, pypa...@googlegroups.com
+1 for TRACE=5

Sent from my comm

Robert Collins

unread,
May 5, 2015, 1:54:27 PM5/5/15
to Marcus Smith, pypa...@googlegroups.com
On 6 May 2015 at 04:47, Marcus Smith <qwc...@gmail.com> wrote:
> "-d"?, don't you mean "-v"?

bah yes.

> there used to be 2 more levels in there, but it was compressed out in a
> logging refactor last year I think
>
> there used to be docs on the mapping of flag count to levels also, but that
> was removed at some point.
>
> https://github.com/pypa/pip/blob/1.5.4/docs/reference/pip.rst#console-logging
>
> I'm concerned that the multiple levels of quiet and verbose has created more
> confusion than value.
> do we think anyone uses -q? or -qq?

Well, someone just had a patch added to add -qq for more finesse.

> I think I'd rather have a simple --debug flag and leave at that, possibly,
> supporting "--debug --debug" for really chatty debugging.

I'll leave the UI debate to you and Donald :). For my part, I suspect
its easier to describe the interactions between two diametrically
opposite flags (-v and -q) than between three. What would --debug -qv
do? [Yes, I know we can define it, but you can't reason your way to an
answer as easily].

More importantly, why was the logging refactored, and how can we avoid
reintroducing the issue that led to that in the first place?

Donald Stufft

unread,
May 5, 2015, 2:04:08 PM5/5/15
to Robert Collins, Marcus Smith, pypa...@googlegroups.com

> On May 5, 2015, at 1:54 PM, Robert Collins <rob...@robertcollins.net> wrote:
>
> On 6 May 2015 at 04:47, Marcus Smith <qwc...@gmail.com> wrote:
>> "-d"?, don't you mean "-v"?
>
> bah yes.
>
>> there used to be 2 more levels in there, but it was compressed out in a
>> logging refactor last year I think
>>
>> there used to be docs on the mapping of flag count to levels also, but that
>> was removed at some point.
>>
>> https://github.com/pypa/pip/blob/1.5.4/docs/reference/pip.rst#console-logging
>>
>> I'm concerned that the multiple levels of quiet and verbose has created more
>> confusion than value.
>> do we think anyone uses -q? or -qq?
>
> Well, someone just had a patch added to add -qq for more finesse.

I think it’s fine to use -vv for this, it’s a pretty standard convention
amongst CLI tools.

>
>> I think I'd rather have a simple --debug flag and leave at that, possibly,
>> supporting "--debug --debug" for really chatty debugging.
>
> I'll leave the UI debate to you and Donald :). For my part, I suspect
> its easier to describe the interactions between two diametrically
> opposite flags (-v and -q) than between three. What would --debug -qv
> do? [Yes, I know we can define it, but you can't reason your way to an
> answer as easily].
>
> More importantly, why was the logging refactored, and how can we avoid
> reintroducing the issue that led to that in the first place?
>

I refactored it away from a custom logging solution to using the standard
library logger. The changes in how -v and -q mapped to levels were not
really a thought out choice, I just needed to map them to levels somehow
and I just picked what made the most sense to me at the time. I think adding
a TRACE (or SPEW) level that’s even more verbose than DEBUG is a fine way to
handle that and that adding more -v’s is an equally fine way to handle it.

---
Donald Stufft
PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

signature.asc

Marcus Smith

unread,
May 9, 2015, 6:09:12 PM5/9/15
to Robert Collins, pypa...@googlegroups.com
> I think I'd rather have a simple --debug flag and leave at that, possibly,
> supporting "--debug --debug" for really chatty debugging.

I'll leave the UI debate to you and Donald :). For my part, I suspect
its easier to describe the interactions between two diametrically
opposite flags (-v and -q) than between three. What would --debug -qv
do? [Yes, I know we can define it, but you can't reason your way to an
answer as easily].

what I was proposing, was getting rid of  the "-q"/"-v" thing altogether, in lieu of "--debug".
not adding a third thing.


Reply all
Reply to author
Forward
0 new messages