b374k
m1n1 1.01
Apache/2.2.15 (CentOS)
Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64
uid=48(apache) gid=48(apache) groups=48(apache)
server ip : 104.21.65.202 | your ip : 10.244.126.0
safemode OFF
 >  / usr / lib64 / python2.6 / distutils /
Filename/usr/lib64/python2.6/distutils/log.py
Size1.57 kb
Permissionrw-r--r--
Ownerapache
Create time23-Dec-2025 17:41
Last modified23-Nov-2010 02:33
Last accessed22-Apr-2026 09:39
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
"""A simple log mechanism styled after PEP 282."""

# This module should be kept compatible with Python 2.1.

# The class here is styled after PEP 282 so that it could later be
# replaced with a standard Python logging implementation.

DEBUG = 1
INFO = 2
WARN = 3
ERROR = 4
FATAL = 5

import sys

class Log:

def __init__(self, threshold=WARN):
self.threshold = threshold

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
else:
print msg % args
sys.stdout.flush()

def log(self, level, msg, *args):
self._log(level, msg, args)

def debug(self, msg, *args):
self._log(DEBUG, msg, args)

def info(self, msg, *args):
self._log(INFO, msg, args)

def warn(self, msg, *args):
self._log(WARN, msg, args)

def error(self, msg, *args):
self._log(ERROR, msg, args)

def fatal(self, msg, *args):
self._log(FATAL, msg, args)

_global_log = Log()
log = _global_log.log
debug = _global_log.debug
info = _global_log.info
warn = _global_log.warn
error = _global_log.error
fatal = _global_log.fatal

def set_threshold(level):
# return the old threshold for use from tests
old = _global_log.threshold
_global_log.threshold = level
return old

def set_verbosity(v):
if v <= 0:
set_threshold(WARN)
elif v == 1:
set_threshold(INFO)
elif v >= 2:
set_threshold(DEBUG)