diff options
author | Joshua Watt <JPEWhacker@gmail.com> | 2021-02-09 09:50:21 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-02-10 23:47:40 +0000 |
commit | f68682a79d83e6399eb403f30a1f113516575f51 (patch) | |
tree | 9b6810d8893aac3fd24c90e62e1659c4a13de0f9 /lib/bb/__init__.py | |
parent | ceddb5b3d229b83c172656053cd29aeb521fcce0 (diff) | |
download | bitbake-f68682a79d83e6399eb403f30a1f113516575f51.tar.gz |
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()]
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/__init__.py')
-rw-r--r-- | lib/bb/__init__.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/bb/__init__.py b/lib/bb/__init__.py index b21773734..99e57a02e 100644 --- a/lib/bb/__init__.py +++ b/lib/bb/__init__.py @@ -21,8 +21,8 @@ class BBHandledException(Exception): The big dilemma for generic bitbake code is what information to give the user when an exception occurs. Any exception inheriting this base exception class has already provided information to the user via some 'fired' message type such as - an explicitly fired event using bb.fire, or a bb.error message. If bitbake - encounters an exception derived from this class, no backtrace or other information + an explicitly fired event using bb.fire, or a bb.error message. If bitbake + encounters an exception derived from this class, no backtrace or other information will be given to the user, its assumed the earlier event provided the relevant information. """ pass @@ -42,7 +42,16 @@ class BBLoggerMixin(object): def setup_bblogger(self, name): if name.split(".")[0] == "BitBake": - self.debug = self.bbdebug + self.debug = self._debug_helper + + def _debug_helper(self, *args, **kwargs): + return self.bbdebug(1, *args, **kwargs) + + def debug2(self, *args, **kwargs): + return self.bbdebug(2, *args, **kwargs) + + def debug3(self, *args, **kwargs): + return self.bbdebug(3, *args, **kwargs) def bbdebug(self, level, msg, *args, **kwargs): loglevel = logging.DEBUG - level + 1 @@ -128,7 +137,7 @@ def debug(lvl, *args): mainlogger.warning("Passed invalid debug level '%s' to bb.debug", lvl) args = (lvl,) + args lvl = 1 - mainlogger.debug(lvl, ''.join(args)) + mainlogger.bbdebug(lvl, ''.join(args)) def note(*args): mainlogger.info(''.join(args)) |