mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
[Bug #620630] Flush stdout after logging every message. Without it,
when output is redirected to a file, compiler error messages show up before Distutils prints the command being invoked.
This commit is contained in:
parent
33a5edf89c
commit
e2d1214c42
1 changed files with 3 additions and 0 deletions
|
@ -9,6 +9,8 @@ WARN = 3
|
||||||
ERROR = 4
|
ERROR = 4
|
||||||
FATAL = 5
|
FATAL = 5
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
class Log:
|
class Log:
|
||||||
|
|
||||||
def __init__(self, threshold=WARN):
|
def __init__(self, threshold=WARN):
|
||||||
|
@ -17,6 +19,7 @@ class Log:
|
||||||
def _log(self, level, msg, args):
|
def _log(self, level, msg, args):
|
||||||
if level >= self.threshold:
|
if level >= self.threshold:
|
||||||
print msg % args
|
print msg % args
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
def log(self, level, msg, *args):
|
def log(self, level, msg, *args):
|
||||||
self._log(level, msg, args)
|
self._log(level, msg, args)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue