summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/log.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/distutils/log.py')
-rw-r--r--Lib/distutils/log.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/distutils/log.py b/Lib/distutils/log.py
index 97319a0..6f949d5 100644
--- a/Lib/distutils/log.py
+++ b/Lib/distutils/log.py
@@ -18,13 +18,14 @@ class Log:
def _log(self, level, msg, args):
if level >= self.threshold:
- if not args:
- # msg may contain a '%'. If args is empty,
- # don't even try to string-format
- print(msg)
+ if args:
+ msg = msg % args
+ if level in (WARN, ERROR, FATAL):
+ stream = sys.stderr
else:
- print(msg % args)
- sys.stdout.flush()
+ stream = sys.stdout
+ stream.write('%s\n' % msg)
+ stream.flush()
def log(self, level, msg, *args):
self._log(level, msg, args)