Vinay Sajip added the comment: 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22195> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com