Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit e51a202

Browse files
author
David Robertson
committed
Unignore assigning to LogRecord attributes
Presumably python/typeshed#8064 makes this ok Cherry-picked from #13521
1 parent edb7d84 commit e51a202

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

synapse/logging/context.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -586,29 +586,29 @@ def filter(self, record: logging.LogRecord) -> Literal[True]:
586586
True to include the record in the log output.
587587
"""
588588
context = current_context()
589-
record.request = self._default_request # type: ignore
589+
record.request = self._default_request
590590

591591
# context should never be None, but if it somehow ends up being, then
592592
# we end up in a death spiral of infinite loops, so let's check, for
593593
# robustness' sake.
594594
if context is not None:
595595
# Logging is interested in the request ID. Note that for backwards
596596
# compatibility this is stored as the "request" on the record.
597-
record.request = str(context) # type: ignore
597+
record.request = str(context)
598598

599599
# Add some data from the HTTP request.
600600
request = context.request
601601
if request is None:
602602
return True
603603

604-
record.ip_address = request.ip_address # type: ignore
605-
record.site_tag = request.site_tag # type: ignore
606-
record.requester = request.requester # type: ignore
607-
record.authenticated_entity = request.authenticated_entity # type: ignore
608-
record.method = request.method # type: ignore
609-
record.url = request.url # type: ignore
610-
record.protocol = request.protocol # type: ignore
611-
record.user_agent = request.user_agent # type: ignore
604+
record.ip_address = request.ip_address
605+
record.site_tag = request.site_tag
606+
record.requester = request.requester
607+
record.authenticated_entity = request.authenticated_entity
608+
record.method = request.method
609+
record.url = request.url
610+
record.protocol = request.protocol
611+
record.user_agent = request.user_agent
612612

613613
return True
614614

0 commit comments

Comments
 (0)