Skip to contentSkip to conversation

oeqa: setup bitbake logger after tinfoil.shutdown

PATCH New Ed Bartosh 1 participant 1 message Feb 10, 2016

lore
Share & tools
lore

Ed Bartosh

author
#0 lore raw

PATCH 1/1 oeqa: setup bitbake logger after tinfoil.shutdown

Bitbake logger stops working after tinfoil.shutdown removes console handler from it. This makes bb.{error,warn,note,critical} messages disappear from the console. Adding console handler to bitbake logger again should fix this issue.

---
 meta/lib/oeqa/utils/commands.py | 11 +++++++++++
 1 file changed, 11 insertions(+)
meta/lib/oeqa/utils/commands.py +11 -0
index 08e2cbb..dfb6c21 100644
@@ -18,6 +18,7 @@ from oeqa.utils import CommandError
 from oeqa.utils import ftools
 import re
 import contextlib
+import bb
 
 class Command(object):
     def __init__(self, command, bg=False, timeout=None, data=None, **options):
@@ -208,6 +209,16 @@ def runqemu(pn, test):
         # Luckily QemuTarget doesn't need it after the constructor.
         tinfoil.shutdown()
 
+    # Setup bitbake logger as console handler is removed by tinfoil.shutdown
+    bblogger = logging.getLogger('BitBake')
+    bblogger.setLevel(logging.INFO)
+    console = logging.StreamHandler(sys.stdout)
+    bbformat = bb.msg.BBLogFormatter("%(levelname)s: %(message)s")
+    if sys.stdout.isatty():
+        bbformat.enable_color()
+    console.setFormatter(bbformat)
+    bblogger.addHandler(console)
+
     try:
         qemu.deploy()
         try:
Signature · 1 line
2.1.4