Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/distutils/log.py

    r2 r391  
    11"""A simple log mechanism styled after PEP 282."""
    2 
    3 # This module should be kept compatible with Python 2.1.
    42
    53# The class here is styled after PEP 282 so that it could later be
     
    2018
    2119    def _log(self, level, msg, args):
     20        if level not in (DEBUG, INFO, WARN, ERROR, FATAL):
     21            raise ValueError('%s wrong log level' % str(level))
     22
    2223        if level >= self.threshold:
    23             if not args:
    24                 # msg may contain a '%'. If args is empty,
    25                 # don't even try to string-format
    26                 print msg
     24            if args:
     25                msg = msg % args
     26            if level in (WARN, ERROR, FATAL):
     27                stream = sys.stderr
    2728            else:
    28                 print msg % args
    29             sys.stdout.flush()
     29                stream = sys.stdout
     30            stream.write('%s\n' % msg)
     31            stream.flush()
    3032
    3133    def log(self, level, msg, *args):
Note: See TracChangeset for help on using the changeset viewer.