[imp] remove mostly unused DEBUG2 logging level

bzr revid: xmo@tinyerp.com-20100302094648-gztszaux31oyfptv
This commit is contained in:
Xavier Morel 2010-03-02 10:46:48 +01:00
parent 0c67a510d7
commit a7d00eb5f3
2 changed files with 2 additions and 11 deletions

View File

@ -130,16 +130,12 @@ class ExportService(object):
LOG_NOTSET = 'notset'
LOG_DEBUG_RPC = 'debug_rpc'
LOG_DEBUG = 'debug'
LOG_DEBUG2 = 'debug2'
LOG_INFO = 'info'
LOG_WARNING = 'warn'
LOG_ERROR = 'error'
LOG_CRITICAL = 'critical'
# add new log level below DEBUG
logging.DEBUG2 = logging.DEBUG - 1
logging.addLevelName(logging.DEBUG2, 'DEBUG2')
logging.DEBUG_RPC = logging.DEBUG2 - 1
logging.DEBUG_RPC = logging.DEBUG - 2
logging.addLevelName(logging.DEBUG_RPC, 'DEBUG_RPC')
def init_logger():
@ -200,7 +196,6 @@ def init_logger():
mapping = {
'DEBUG_RPC': ('blue', 'white'),
'DEBUG2': ('green', 'white'),
'DEBUG': ('blue', 'default'),
'INFO': ('green', 'default'),
'WARNING': ('yellow', 'default'),
@ -226,10 +221,6 @@ class Logger(object):
log = logging.getLogger(tools.ustr(name))
if level == LOG_DEBUG2 and not hasattr(log, level):
fct = lambda msg, *args, **kwargs: log.log(logging.DEBUG2, msg, *args, **kwargs)
setattr(log, LOG_DEBUG2, fct)
if level == LOG_DEBUG_RPC and not hasattr(log, level):
fct = lambda msg, *args, **kwargs: log.log(logging.DEBUG_RPC, msg, *args, **kwargs)
setattr(log, LOG_DEBUG_RPC, fct)

View File

@ -61,7 +61,7 @@ re_from = re.compile('.* from "?([a-zA-Z_0-9]+)"? .*$');
re_into = re.compile('.* into "?([a-zA-Z_0-9]+)"? .*$');
def log(msg, lvl=netsvc.LOG_DEBUG2):
def log(msg, lvl=netsvc.LOG_DEBUG):
logger = netsvc.Logger()
logger.notifyChannel('sql', lvl, msg)