summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/__init__.py
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2021-02-09 09:50:21 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-02-10 23:48:16 +0000
commit75f87db413f3659fee18eff389b7b339b01cce15 (patch)
treee733135549b516c72c4f34172b6bbf865377fc76 /bitbake/lib/bb/__init__.py
parent7283a0b3b6ca49d0d2e13593333a580ef10439a8 (diff)
downloadpoky-75f87db413f3659fee18eff389b7b339b01cce15.tar.gz
bitbake: logging: Make bitbake logger compatible with python logger
The bitbake logger overrode the definition of the debug() logging call to include a debug level, but this causes problems with code that may be using standard python logging, since the extra argument is interpreted differently. Instead, change the bitbake loggers debug() call to match the python logger call and add a debug2() and debug3() API to replace calls that were logging to a different debug level. [RP: Small fix to ensure bb.debug calls bbdebug()] (Bitbake rev: f68682a79d83e6399eb403f30a1f113516575f51) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/__init__.py')
-rw-r--r--bitbake/lib/bb/__init__.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py
index b217737347..99e57a02e4 100644
--- a/bitbake/lib/bb/__init__.py
+++ b/bitbake/lib/bb/__init__.py
@@ -21,8 +21,8 @@ class BBHandledException(Exception):
21 The big dilemma for generic bitbake code is what information to give the user 21 The big dilemma for generic bitbake code is what information to give the user
22 when an exception occurs. Any exception inheriting this base exception class 22 when an exception occurs. Any exception inheriting this base exception class
23 has already provided information to the user via some 'fired' message type such as 23 has already provided information to the user via some 'fired' message type such as
24 an explicitly fired event using bb.fire, or a bb.error message. If bitbake 24 an explicitly fired event using bb.fire, or a bb.error message. If bitbake
25 encounters an exception derived from this class, no backtrace or other information 25 encounters an exception derived from this class, no backtrace or other information
26 will be given to the user, its assumed the earlier event provided the relevant information. 26 will be given to the user, its assumed the earlier event provided the relevant information.
27 """ 27 """
28 pass 28 pass
@@ -42,7 +42,16 @@ class BBLoggerMixin(object):
42 42
43 def setup_bblogger(self, name): 43 def setup_bblogger(self, name):
44 if name.split(".")[0] == "BitBake": 44 if name.split(".")[0] == "BitBake":
45 self.debug = self.bbdebug 45 self.debug = self._debug_helper
46
47 def _debug_helper(self, *args, **kwargs):
48 return self.bbdebug(1, *args, **kwargs)
49
50 def debug2(self, *args, **kwargs):
51 return self.bbdebug(2, *args, **kwargs)
52
53 def debug3(self, *args, **kwargs):
54 return self.bbdebug(3, *args, **kwargs)
46 55
47 def bbdebug(self, level, msg, *args, **kwargs): 56 def bbdebug(self, level, msg, *args, **kwargs):
48 loglevel = logging.DEBUG - level + 1 57 loglevel = logging.DEBUG - level + 1
@@ -128,7 +137,7 @@ def debug(lvl, *args):
128 mainlogger.warning("Passed invalid debug level '%s' to bb.debug", lvl) 137 mainlogger.warning("Passed invalid debug level '%s' to bb.debug", lvl)
129 args = (lvl,) + args 138 args = (lvl,) + args
130 lvl = 1 139 lvl = 1
131 mainlogger.debug(lvl, ''.join(args)) 140 mainlogger.bbdebug(lvl, ''.join(args))
132 141
133def note(*args): 142def note(*args):
134 mainlogger.info(''.join(args)) 143 mainlogger.info(''.join(args))