[Twisted-Python] Re: [Twisted-commits] r14614 - Describe log.debug, and 'printed' and 'debug' log dict items.

James Y Knight foom at fuhm.net
Tue Oct 4 16:31:58 EDT 2005

On Oct 4, 2005, at 1:00 PM, Scott Lamb wrote:

> On Oct 4, 2005, at 12:20 AM, Nicola Larosa wrote:
>> Also, a few words to the effect of *why* it should be deprecated  
>> would be
>> useful. We use it quite a lot, and I'd appreciate a few comments.
> Me, too, me too.
> In my day job, I develop a lot of Java code. We have the luxury of  
> granular logging. I can switch, on a per-class basis, the output  
> level to trace, debug, warn, error, or fatal. That's handy.
> In Twisted, I see log.msg(), log.debug(), and log.err(). Why is one  
> of these levels going away? Is it just not normal to use logging  
> for debugging? What do you do instead?

The "log levels", such as they are, are (and have been for ages)  
implemented as keyword args on msg:
log.msg("error message", isError=1)
log.msg("normal message")
log.msg("debug message", debug=1).

The log.debug function just added the debug=1 argument for you.
The log.err func is poorly named, because you might be tempted to use  
it to emit error-level info, when really it is for emitting Exception/ 
Failure objects.

All in all, the log level functionality in twisted.python.log is  
pretty silly, but substantially unchanged.


More information about the Twisted-Python mailing list