bitbake/msg: Ensure lower level debug messages have DEBUG prefix and reuse log level values from formatter
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
ded83ffc3b
commit
7586adb360
|
@ -33,6 +33,8 @@ import bb.event
|
||||||
class BBLogFormatter(logging.Formatter):
|
class BBLogFormatter(logging.Formatter):
|
||||||
"""Formatter which ensures that our 'plain' messages (logging.INFO + 1) are used as is"""
|
"""Formatter which ensures that our 'plain' messages (logging.INFO + 1) are used as is"""
|
||||||
|
|
||||||
|
DEBUG3 = logging.DEBUG - 2
|
||||||
|
DEBUG2 = logging.DEBUG - 1
|
||||||
DEBUG = logging.DEBUG
|
DEBUG = logging.DEBUG
|
||||||
VERBOSE = logging.INFO - 1
|
VERBOSE = logging.INFO - 1
|
||||||
NOTE = logging.INFO
|
NOTE = logging.INFO
|
||||||
|
@ -42,10 +44,12 @@ class BBLogFormatter(logging.Formatter):
|
||||||
CRITICAL = logging.CRITICAL
|
CRITICAL = logging.CRITICAL
|
||||||
|
|
||||||
levelnames = {
|
levelnames = {
|
||||||
|
DEBUG3 : 'DEBUG',
|
||||||
|
DEBUG2 : 'DEBUG',
|
||||||
DEBUG : 'DEBUG',
|
DEBUG : 'DEBUG',
|
||||||
PLAIN : '',
|
|
||||||
NOTE : 'NOTE',
|
|
||||||
VERBOSE: 'NOTE',
|
VERBOSE: 'NOTE',
|
||||||
|
NOTE : 'NOTE',
|
||||||
|
PLAIN : '',
|
||||||
WARNING : 'WARNING',
|
WARNING : 'WARNING',
|
||||||
ERROR : 'ERROR',
|
ERROR : 'ERROR',
|
||||||
CRITICAL: 'ERROR',
|
CRITICAL: 'ERROR',
|
||||||
|
@ -60,7 +64,7 @@ class BBLogFormatter(logging.Formatter):
|
||||||
|
|
||||||
def format(self, record):
|
def format(self, record):
|
||||||
record.levelname = self.getLevelName(record.levelno)
|
record.levelname = self.getLevelName(record.levelno)
|
||||||
if record.levelno == logging.INFO + 1:
|
if record.levelno == self.PLAIN:
|
||||||
return record.getMessage()
|
return record.getMessage()
|
||||||
else:
|
else:
|
||||||
return logging.Formatter.format(self, record)
|
return logging.Formatter.format(self, record)
|
||||||
|
@ -123,9 +127,9 @@ def get_debug_level(msgdomain = domain.Default):
|
||||||
|
|
||||||
def set_verbose(level):
|
def set_verbose(level):
|
||||||
if level:
|
if level:
|
||||||
logger.setLevel(logging.INFO - 1)
|
logger.setLevel(BBLogFormatter.VERBOSE)
|
||||||
else:
|
else:
|
||||||
logger.setLevel(logging.INFO)
|
logger.setLevel(BBLogFormatter.INFO)
|
||||||
|
|
||||||
def set_debug_domains(domainargs):
|
def set_debug_domains(domainargs):
|
||||||
for (domainarg, iterator) in groupby(domainargs):
|
for (domainarg, iterator) in groupby(domainargs):
|
||||||
|
|
Loading…
Reference in New Issue