mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
using log.warn for sys.stderr
This commit is contained in:
parent
ef660e8e50
commit
c7cd138bc2
2 changed files with 9 additions and 9 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue