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

Jp Calderone exarkun at divmod.com
Tue Oct 4 21:49:04 MDT 2005


On Tue, 4 Oct 2005 23:18:40 -0400, James Y Knight <foom at fuhm.net> wrote:
>On Oct 4, 2005, at 5:01 PM, glyph at divmod.com wrote:
>>On Tue, 4 Oct 2005 16:31:58 -0400, James Y Knight <foom at fuhm.net>  wrote:
>>>log.msg("error message", isError=1)
>>
>>Please don't ever do this.  Log observers which check the isError  flag 
>>expect a stricter interface; a Failure object, for one thing,  like log.err 
>>puts there.
>
>Actually they don't. They expect that the failure keyword may or may  not be 
>present. The only use of "levels" we have (DefaultObserver  only showing 
>error messages) filters out any non-isError messages, so  there are 
>circumstances in which you want to make sure you're  emitting an isError=1 
>message.
>>Really this should be using the interface keyword arg that itamar 
>>mentioned, set to something like log.IErrorReport.  To ensure  portability 
>>when that does become the convention, use log.err.
>
>But sometimes you cannot use log.err because you want to emit an  error- 
>level _message_, rather than the repr of an object, an  exception, or a 
>failure.
>
>Notice how log.err("Foo!") doesn't actually do what you might hope. 
>Contrast with log.msg("Foo!", isError=1) which does.

Neither of these is supported behavior.  They're implementation accidents and shouldn't be used.  It's understandable that this is surprising, since I doubt it's ever been written down anywhere.

Jp




More information about the Twisted-Python mailing list