Skip to content

Commit 4c9731b

Browse files
authored
Coerce None values into strings in logentry params. (#4121)
Nice rendering of log messages containing parameters that are `None` values does not work. There we coerce `None` values into strings to have nicer messages in Sentry UI. Fixes #3660
1 parent 42ad8df commit 4c9731b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sentry_sdk/integrations/logging.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,11 @@ def _emit(self, record):
248248
else:
249249
event["logentry"] = {
250250
"message": to_string(record.msg),
251-
"params": record.args,
251+
"params": (
252+
tuple(str(arg) if arg is None else arg for arg in record.args)
253+
if record.args
254+
else ()
255+
),
252256
}
253257

254258
event["extra"] = self._extra_from_record(record)

0 commit comments

Comments
 (0)