On Jun 6, 2016, at 04:21, Phil Mayers <p.mayers@imperial.ac.uk> wrote:


I'd like to submit a patch to convert t.conch.ssh to the new logging. The main reason is that the conch code logs a *lot* of really, really, really boring crap that I want to throw away because it just clutters up the logs e.g.


No need to justify it - any work to move us internally to new APIs so we can finally get to the business of deprecating the old ones would be great!

Moving it to the new logging would, at very least, let me trivially write an observer which throws away these by module.

No need to write one!  This is an explicit use-case for new logging: see https://twistedmatrix.com/documents/16.2.0/api/twisted.logger.LogLevelFilterPredicate.html and https://twistedmatrix.com/documents/16.2.0/api/twisted.logger.FilteringLogObserver.html

(You may also be interested in figuring out a solution to https://twistedmatrix.com/trac/ticket/7969 )

Does anyone have an example ticket/commit for a conversion to the new logging showing the general style, and the technique used for writing tests for that?

twistd itself was converted over - https://twistedmatrix.com/trac/ticket/8235 - but of course that's mostly from the consumer side rather than emitting logs.  It shouldn't be too complex, honestly; just get rid of all manual string formatting, and convert any %()s format strings to {}.  The testing support is the same as for the old logging system (add a global observer, remove it in an addCleanup, assert about the things it caught) because it's still just key-value pairs, they're just better-defined now.