[Imaplib2-devel] imaplib2 debugging
Piers Lauder
piers at janeelix.com
Sun May 8 21:31:01 BST 2011
On Sat, 07 May 2011 11:42:32 +0200, Sebastian Spaeth wrote:
>
> On Sat, 07 May 2011 10:37:45 +1000, Piers Lauder <piers at janeelix.com> wrote:
> > I have committed a new version of imaplib2 with extra logging, and a
> > new paremeter to the class 'debug_buf_lvl' (default: 3), that controls
> > log buffering.
> >
> > So, to invoke IMAP4 with output to stderr at logging level 3, one would
> > invoke as:
> > IMAP4(..., debug=3, debug_buf_lvl=2)
>
> One more question:
>
> Calling IMAP4(debug=3,...) will call:
>
> _init_debug(self, debug=3,...):
> self.debug = debug is not None and debug or Debug is not None and
Debuggor 0
>
> so self.debug becomes a Boolean, rather than an int, right?
No, that can be restated as:
(debug is not None and debug) or (Debug is not None and Debug) or 0
Which is the same as:
debug or Debug or 0
which is an int (provided debug and Debug are). Deprecated Python idiom :-)
> Because in def _log() and elsewhere you use:
>
> if lvl>self.debug:
> <actually log something>
>
> which would be true for any value >1 of lvl. Or am I grossly misreading
> things?
See above :-)
More information about the OfflineIMAP-project
mailing list