mirror of
https://git.yoctoproject.org/poky
synced 2026-04-05 08:02:25 +02:00
bitbake: lib/bb/msg: Convert default domains to a dictionary
Converts the default domain variable to a dictionary where the keys are
the logging domains and the values are the logging level (instead of the
debug count). This makes it easier to deal with the logging domains and
the awkward conversion from a list to a dictionary only needs to be done
once when logging is initialized. Finally, other code has been written
that already assumes this variable is a dictionary, see:
f04cd93109 ("bitbake: lib/bb: Optimise out debug messages from cooker")
(Bitbake rev: f32a8bc7ff7a0b0750b6934a96f5d48391b1383a)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
954b5258f1
commit
26473bfbea
@@ -43,12 +43,13 @@ class BBLogger(Logger):
|
||||
Logger.__init__(self, name)
|
||||
|
||||
def bbdebug(self, level, msg, *args, **kwargs):
|
||||
loglevel = logging.DEBUG - level + 1
|
||||
if not bb.event.worker_pid:
|
||||
if self.name in bb.msg.loggerDefaultDomains and level > (bb.msg.loggerDefaultDomains[self.name]):
|
||||
if self.name in bb.msg.loggerDefaultDomains and loglevel > (bb.msg.loggerDefaultDomains[self.name]):
|
||||
return
|
||||
if level > (bb.msg.loggerDefaultDebugLevel):
|
||||
return
|
||||
return self.log(logging.DEBUG - level + 1, msg, *args, **kwargs)
|
||||
return self.log(loglevel, msg, *args, **kwargs)
|
||||
|
||||
def plain(self, msg, *args, **kwargs):
|
||||
return self.log(logging.INFO + 1, msg, *args, **kwargs)
|
||||
|
||||
@@ -138,7 +138,7 @@ class BBLogFilterStdOut(BBLogFilter):
|
||||
loggerDefaultDebugLevel = 0
|
||||
loggerDefaultVerbose = False
|
||||
loggerVerboseLogs = False
|
||||
loggerDefaultDomains = []
|
||||
loggerDefaultDomains = {}
|
||||
|
||||
def init_msgconfig(verbose, debug, debug_domains=None):
|
||||
"""
|
||||
@@ -148,15 +148,16 @@ def init_msgconfig(verbose, debug, debug_domains=None):
|
||||
bb.msg.loggerDefaultVerbose = verbose
|
||||
if verbose:
|
||||
bb.msg.loggerVerboseLogs = True
|
||||
|
||||
bb.msg.loggerDefaultDomains = {}
|
||||
if debug_domains:
|
||||
bb.msg.loggerDefaultDomains = debug_domains
|
||||
else:
|
||||
bb.msg.loggerDefaultDomains = []
|
||||
for (domainarg, iterator) in groupby(debug_domains):
|
||||
dlevel = len(tuple(iterator))
|
||||
bb.msg.loggerDefaultDomains["BitBake.%s" % domainarg] = logging.DEBUG - dlevel + 1
|
||||
|
||||
def constructLogOptions():
|
||||
debug = loggerDefaultDebugLevel
|
||||
verbose = loggerDefaultVerbose
|
||||
domains = loggerDefaultDomains
|
||||
|
||||
if debug:
|
||||
level = BBLogFormatter.DEBUG - debug + 1
|
||||
@@ -165,11 +166,7 @@ def constructLogOptions():
|
||||
else:
|
||||
level = BBLogFormatter.NOTE
|
||||
|
||||
debug_domains = {}
|
||||
for (domainarg, iterator) in groupby(domains):
|
||||
dlevel = len(tuple(iterator))
|
||||
debug_domains["BitBake.%s" % domainarg] = logging.DEBUG - dlevel + 1
|
||||
return level, debug_domains
|
||||
return level, loggerDefaultDomains
|
||||
|
||||
def addDefaultlogFilter(handler, cls = BBLogFilter, forcelevel=None):
|
||||
level, debug_domains = constructLogOptions()
|
||||
|
||||
Reference in New Issue
Block a user