[FIX] core: lower_logging record.args not str

As per the logging documentation, it is fine to send arguments that are
not string. Logging takes care of stringifying and injecting the
arguments in the message template.

closes odoo/odoo#78172

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
This commit is contained in:
Julien Castiaux
2021-10-11 15:08:44 +00:00
parent 6c12a56eed
commit 86c27b7156
+1 -1
View File
@@ -836,7 +836,7 @@ class lower_logging(logging.Handler):
record.levelname = f'_{record.levelname}'
record.levelno = self.max_level
self.had_error_log = True
record.args = tuple(arg.replace('Traceback (most recent call last):', '_Traceback_ (most recent call last):') for arg in record.args)
record.args = tuple(arg.replace('Traceback (most recent call last):', '_Traceback_ (most recent call last):') if type(arg) is str else arg for arg in record.args) # pylint: disable=unidiomatic-typecheck
for handler in self.old_handlers:
if handler.level <= record.levelno: