[oe-commits] [bitbake] 01/22: lib/bb/msg: Convert default domains to a dictionary
git at git.openembedded.org
git at git.openembedded.org
Thu Mar 12 23:04:31 UTC 2020
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository bitbake.
commit f32a8bc7ff7a0b0750b6934a96f5d48391b1383a
Author: Joshua Watt <JPEWhacker at gmail.com>
AuthorDate: Mon Mar 9 11:33:39 2020 -0500
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")
Signed-off-by: Joshua Watt <JPEWhacker at gmail.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
lib/bb/__init__.py | 5 +++--
lib/bb/msg.py | 17 +++++++----------
2 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/lib/bb/__init__.py b/lib/bb/__init__.py
index 88641e2..acd4af1 100644
--- a/lib/bb/__init__.py
+++ b/lib/bb/__init__.py
@@ -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)
diff --git a/lib/bb/msg.py b/lib/bb/msg.py
index 33c0e2f..d1b0e92 100644
--- a/lib/bb/msg.py
+++ b/lib/bb/msg.py
@@ -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()
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list