From 8bc154764a805a62b757e690620c0f652ed1df74 Mon Sep 17 00:00:00 2001 From: Delio Brignoli Date: Sun, 31 May 2015 06:45:56 +0200 Subject: [PATCH] logging: log to sys.stderr instead of sys.stdout --- logging/logging.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/logging/logging.py b/logging/logging.py index f3184bd1..662f4e03 100644 --- a/logging/logging.py +++ b/logging/logging.py @@ -4,6 +4,8 @@ # Basic, useful module, by CPython impl depends on module "string" which # uses metaclasses. +import sys + CRITICAL = 50 ERROR = 40 WARNING = 30 @@ -32,7 +34,7 @@ class Logger: def log(self, level, msg, *args): if level >= (self.level or _level): - print(("%s:%s:" + msg) % ((self._level_str(level), self.name) + args)) + print(("%s:%s:" + msg) % ((self._level_str(level), self.name) + args), file=sys.stderr) def debug(self, msg, *args): self.log(DEBUG, msg, *args)