Message ID | 20220919091312.894690-1-jose.quaresma@foundries.io |
---|---|
State | Accepted, archived |
Commit | c1d9c1d25ce36848040dc0ce182835e497ccbb82 |
Headers | show |
Series | [1/2] lib/bb: warning when the debug message is invalid | expand |
LGTM Reviewed-by: Joshua Watt <JPEWhacker@gmail.com> On Mon, Sep 19, 2022 at 4:14 AM Jose Quaresma <quaresma.jose@gmail.com> wrote: > > There are many messed up calls for the debug log, > so is better to warm about this as they will not work > as expected. > > The level need to be an integer and the msg a string. > > Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io> > --- > lib/bb/__init__.py | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/lib/bb/__init__.py b/lib/bb/__init__.py > index b8333bdb..81b5a628 100644 > --- a/lib/bb/__init__.py > +++ b/lib/bb/__init__.py > @@ -60,6 +60,10 @@ class BBLoggerMixin(object): > return > if loglevel < bb.msg.loggerDefaultLogLevel: > return > + > + if not isinstance(level, int) or not isinstance(msg, str): > + mainlogger.warning("Invalid arguments in bbdebug: %s" % repr((level, msg,) + args)) > + > return self.log(loglevel, msg, *args, **kwargs) > > def plain(self, msg, *args, **kwargs): > -- > 2.34.1 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#13978): https://lists.openembedded.org/g/bitbake-devel/message/13978 > Mute This Topic: https://lists.openembedded.org/mt/93777548/3616693 > Group Owner: bitbake-devel+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [JPEWhacker@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
diff --git a/lib/bb/__init__.py b/lib/bb/__init__.py index b8333bdb..81b5a628 100644 --- a/lib/bb/__init__.py +++ b/lib/bb/__init__.py @@ -60,6 +60,10 @@ class BBLoggerMixin(object): return if loglevel < bb.msg.loggerDefaultLogLevel: return + + if not isinstance(level, int) or not isinstance(msg, str): + mainlogger.warning("Invalid arguments in bbdebug: %s" % repr((level, msg,) + args)) + return self.log(loglevel, msg, *args, **kwargs) def plain(self, msg, *args, **kwargs):
There are many messed up calls for the debug log, so is better to warm about this as they will not work as expected. The level need to be an integer and the msg a string. Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io> --- lib/bb/__init__.py | 4 ++++ 1 file changed, 4 insertions(+)