On 02:30 pm, petshm...@googlemail.com wrote: >Hello! > >Is it possible to print multiline debug messages into log? > >If print a query it looks like this > > >2010-05-06 10:10:07 [HTTPChannel,0,192.168.2.15] >SELECT * >2010-05-06 10:10:07 [HTTPChannel,0,192.168.2.15] >FROM foo AS a >2010-05-06 10:10:07 [HTTPChannel,0,192.168.2.15] >JOIN bar AS b ON a.id = b.id >2010-05-06 10:10:07 [HTTPChannel,0,192.168.2.15] >WHERE a.id = 1 >2010-05-06 10:10:07 [HTTPChannel,0,192.168.2.15] >ORDER BY id DESC >2010-05-06 10:10:07 [HTTPChannel,0,192.168.2.15] >LIMIT 1; > > >it would be more practical to have only the query without timestamp on >other things
Use log.msg, instead. `print` integration is meant as a debugging aid, not a general logging facility. >>> from twisted.python.log import startLogging >>> from sys import stdout >>> startLogging(stdout) 2010-05-06 10:36:41-0400 [-] Log opened. 2010-05-06 10:36:41-0400 [-] <twisted.python.log.FileLogObserver instance at 0xb766424c> >>> from twisted.python.log import msg >>> print 'hello\nworld' 2010-05-06 10:36:50-0400 [-] hello 2010-05-06 10:36:50-0400 [-] world >>> msg('hello\nworld') 2010-05-06 10:36:54-0400 [-] hello world >>> Jean-Paul _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python