Skip to content

Commit b3ca715

Browse files
authored
Handle logging None with loguru (#331)
1 parent c763236 commit b3ca715

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

logfire/integrations/loguru.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,21 @@ def fill_attributes(self, record: LogRecord) -> dict[str, Any]:
3737
frame = inspect.currentframe()
3838
while frame: # pragma: no branch
3939
if frame.f_code is _LOG_METHOD_CODE:
40-
msg_template = frame.f_locals.get('message')
41-
if msg_template is not None:
42-
attributes[ATTRIBUTES_MESSAGE_TEMPLATE_KEY] = msg_template
40+
frame_locals = frame.f_locals
41+
if 'message' in frame_locals:
42+
attributes[ATTRIBUTES_MESSAGE_TEMPLATE_KEY] = frame_locals['message']
4343
else: # pragma: no cover
4444
_warn_inspection_failure()
4545

46-
args = frame.f_locals.get('args')
46+
args = frame_locals.get('args')
4747
if isinstance(args, (tuple, list)):
4848
if args:
4949
attributes[ATTRIBUTES_LOGGING_ARGS_KEY] = args
5050
else: # pragma: no cover
5151
_warn_inspection_failure()
5252

5353
if record.exc_info:
54-
original_record = frame.f_locals.get('log_record')
54+
original_record = frame_locals.get('log_record')
5555
if isinstance(original_record, dict):
5656
message = original_record.get('message') # type: ignore
5757
if isinstance(message, str) and record.msg.startswith(

0 commit comments

Comments
 (0)