[Twisted-Python] Names DNS Client too chatty
Jason J. W. Williams
jasonjwwilliams at gmail.com
Tue Jan 25 14:52:00 MST 2011
On Mon, Jan 24, 2011 at 10:01 PM, Glyph Lefkowitz
<glyph at twistedmatrix.com> wrote:
> While I agree with the general sentiment (incremental improvements that can
> be done now are pretty much always better than gigantic overhauls that have
> to be put off until later) the current logging system is already pretty much
> designed for this, we're just not using it right. Trimming JP's message a
> bit to just the key part:
>
> This doesn't even have to mean changes to LogPublisher. It could mean
> replacing:
>
> log.msg("%s starting on %s"%(self.protocol.__class__,
>
> self._realPortNumber))
>
> with:
>
> log.msg(
>
> event_source=self,
>
> event_type="start",
>
> protocol=self.protocol,
>
> port_number=self._realPortNumber)
>
Playing with this a bit, the above change does indeed blackhole the
log message. The question then is how someone can get these actually
outputted the log when they want to. Right now the TCP unit test for
test_connectionLostLogMsg expects textual output to the log. I'm
re-working the test to instead expect the dict with the same values
passed in, but that just ensures the data is properly passed to
log.msg() not that it's going to show up if you want it to.
-J
More information about the Twisted-Python
mailing list