Skip to contentSkip to conversation

bitbake: knotty: Re-enable command line logging levels

PATCH New Joshua Watt 1 participant 1 message Apr 30, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bitbake: knotty: Re-enable command line logging levels

The "-l" command line options to enable specific logging domains wasn't working with the switch to structured logging because they were only being used to set the legacy logging domains. Fix this by implementing the logic to parse the user options into the logging configuration.

---
 bitbake/lib/bb/ui/knotty.py | 8 ++++++++
 1 file changed, 8 insertions(+)
bitbake/lib/bb/ui/knotty.py +8 -0
index 0efa614dfc..65ff2727dc 100644
@@ -21,6 +21,7 @@ import fcntl
 import struct
 import copy
 import atexit
+from itertools import groupby
 
 from bb.ui import uihelper
 
@@ -539,6 +540,13 @@ def main(server, eventHandler, params, tf = TerminalFilter):
         except OSError:
            pass
 
+    # Add the logging domains specified by the user on the command line
+    for (domainarg, iterator) in groupby(params.debug_domains):
+        dlevel = len(tuple(iterator))
+        l = logconfig["loggers"].setdefault("BitBake.%s" % domainarg, {})
+        l["level"] = logging.DEBUG - dlevel + 1
+        l.setdefault("handlers", []).extend(["BitBake.verbconsole"])
+
     conf = bb.msg.setLoggingConfig(logconfig, logconfigfile)
 
     if sys.stdin.isatty() and sys.stdout.isatty():
Signature · 1 line
2.31.1