summaryrefslogtreecommitdiffstats
path: root/lib/bb/msg.py
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2020-03-09 11:33:41 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-03-12 23:01:48 +0000
commit41bd155faf7f65cb0727fcce972715769b26ca89 (patch)
treef8e5355133412a0f471760906e45672ceacfb4ca /lib/bb/msg.py
parent9624d42133e024fd044d0d089c7017ed53eed874 (diff)
downloadbitbake-41bd155faf7f65cb0727fcce972715769b26ca89.tar.gz
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 Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/msg.py')
-rw-r--r--lib/bb/msg.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/lib/bb/msg.py b/lib/bb/msg.py
index d1b0e929d..ea6a9543f 100644
--- a/lib/bb/msg.py
+++ b/lib/bb/msg.py
@@ -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()