Message225324
This is easy enough to do, I posted about it in 2009 here:
http://plumberjack.blogspot.co.uk/2009/09/how-to-treat-logger-like-output-stream.html
Basically, something like
class LoggerWriter(object):
def __init__(self, logger, level):
self.logger = logger
self.level = level
def write(self, message):
if message != '\n':
self.logger.log(self.level, message)
def flush(self):
pass
I'm not sure something like this really needs to be in the stdlib.
Loggers shouldn't have a method with a print-like signature, since it's Handlers that are concerned with output destinations such as streams. |
|
Date |
User |
Action |
Args |
2014-08-14 23:25:54 | vinay.sajip | set | recipients:
+ vinay.sajip, pitrou, BreamoreBoy, Saimadhav.Heblikar |
2014-08-14 23:25:54 | vinay.sajip | set | messageid: <1408058754.4.0.428263236843.issue22195@psf.upfronthosting.co.za> |
2014-08-14 23:25:54 | vinay.sajip | link | issue22195 messages |
2014-08-14 23:25:53 | vinay.sajip | create | |
|