mirror of
https://git.yoctoproject.org/poky
synced 2026-04-30 12:32:12 +02:00
bitbake: lib/bb/msg: Use log level instead of debug count
Passes around the actual logging level as the default log level variable instead of the debug count. This makes it easier to deal with logging levels since the conversion from debug count and verbose flag only has to occur once when logging is initialized and after that actual log levels can be used (Bitbake rev: 41bd155faf7f65cb0727fcce972715769b26ca89) 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
77fbe09245
commit
4c9a412999
@@ -414,7 +414,7 @@ class BitbakeWorker(object):
|
||||
|
||||
def handle_workerdata(self, data):
|
||||
self.workerdata = pickle.loads(data)
|
||||
bb.msg.loggerDefaultDebugLevel = self.workerdata["logdefaultdebug"]
|
||||
bb.msg.loggerDefaultLogLevel = self.workerdata["logdefaultlevel"]
|
||||
bb.msg.loggerDefaultVerbose = self.workerdata["logdefaultverbose"]
|
||||
bb.msg.loggerVerboseLogs = self.workerdata["logdefaultverboselogs"]
|
||||
bb.msg.loggerDefaultDomains = self.workerdata["logdefaultdomain"]
|
||||
|
||||
@@ -47,7 +47,7 @@ class BBLogger(Logger):
|
||||
if not bb.event.worker_pid:
|
||||
if self.name in bb.msg.loggerDefaultDomains and loglevel > (bb.msg.loggerDefaultDomains[self.name]):
|
||||
return
|
||||
if level > (bb.msg.loggerDefaultDebugLevel):
|
||||
if loglevel > bb.msg.loggerDefaultLogLevel:
|
||||
return
|
||||
return self.log(loglevel, msg, *args, **kwargs)
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ class BBLogFilterStdOut(BBLogFilter):
|
||||
# Message control functions
|
||||
#
|
||||
|
||||
loggerDefaultDebugLevel = 0
|
||||
loggerDefaultLogLevel = BBLogFormatter.NOTE
|
||||
loggerDefaultVerbose = False
|
||||
loggerVerboseLogs = False
|
||||
loggerDefaultDomains = {}
|
||||
@@ -144,11 +144,17 @@ def init_msgconfig(verbose, debug, debug_domains=None):
|
||||
"""
|
||||
Set default verbosity and debug levels config the logger
|
||||
"""
|
||||
bb.msg.loggerDefaultDebugLevel = debug
|
||||
bb.msg.loggerDefaultVerbose = verbose
|
||||
if verbose:
|
||||
bb.msg.loggerVerboseLogs = True
|
||||
|
||||
if debug:
|
||||
bb.msg.loggerDefaultLogLevel = BBLogFormatter.DEBUG - debug + 1
|
||||
elif verbose:
|
||||
bb.msg.loggerDefaultLogLevel = BBLogFormatter.VERBOSE
|
||||
else:
|
||||
bb.msg.loggerDefaultLogLevel = BBLogFormatter.NOTE
|
||||
|
||||
bb.msg.loggerDefaultDomains = {}
|
||||
if debug_domains:
|
||||
for (domainarg, iterator) in groupby(debug_domains):
|
||||
@@ -156,17 +162,7 @@ def init_msgconfig(verbose, debug, debug_domains=None):
|
||||
bb.msg.loggerDefaultDomains["BitBake.%s" % domainarg] = logging.DEBUG - dlevel + 1
|
||||
|
||||
def constructLogOptions():
|
||||
debug = loggerDefaultDebugLevel
|
||||
verbose = loggerDefaultVerbose
|
||||
|
||||
if debug:
|
||||
level = BBLogFormatter.DEBUG - debug + 1
|
||||
elif verbose:
|
||||
level = BBLogFormatter.VERBOSE
|
||||
else:
|
||||
level = BBLogFormatter.NOTE
|
||||
|
||||
return level, loggerDefaultDomains
|
||||
return loggerDefaultLogLevel, loggerDefaultDomains
|
||||
|
||||
def addDefaultlogFilter(handler, cls = BBLogFilter, forcelevel=None):
|
||||
level, debug_domains = constructLogOptions()
|
||||
|
||||
@@ -1254,7 +1254,7 @@ class RunQueue:
|
||||
"fakerootdirs" : self.rqdata.dataCaches[mc].fakerootdirs,
|
||||
"fakerootnoenv" : self.rqdata.dataCaches[mc].fakerootnoenv,
|
||||
"sigdata" : bb.parse.siggen.get_taskdata(),
|
||||
"logdefaultdebug" : bb.msg.loggerDefaultDebugLevel,
|
||||
"logdefaultlevel" : bb.msg.loggerDefaultLogLevel,
|
||||
"logdefaultverbose" : bb.msg.loggerDefaultVerbose,
|
||||
"logdefaultverboselogs" : bb.msg.loggerVerboseLogs,
|
||||
"logdefaultdomain" : bb.msg.loggerDefaultDomains,
|
||||
|
||||
Reference in New Issue
Block a user