Include rejected status when we log events. (#11008)

If we find ourselves dealing with rejected events, we proably want to know
about it. Let's include it in the stringification of the event so that it gets
logged.
This commit is contained in:
Richard van der Hoff 2021-10-19 11:21:50 +02:00 committed by GitHub
parent 3ab55d43bd
commit d85bc9a4a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

1
changelog.d/11008.misc Normal file
View File

@ -0,0 +1 @@
Include rejected status when we log events.

View File

@ -348,12 +348,16 @@ class EventBase(metaclass=abc.ABCMeta):
return self.__repr__()
def __repr__(self):
return "<%s event_id=%r, type=%r, state_key=%r, outlier=%s>" % (
self.__class__.__name__,
self.event_id,
self.get("type", None),
self.get("state_key", None),
self.internal_metadata.is_outlier(),
rejection = f"REJECTED={self.rejected_reason}, " if self.rejected_reason else ""
return (
f"<{self.__class__.__name__} "
f"{rejection}"
f"event_id={self.event_id}, "
f"type={self.get('type')}, "
f"state_key={self.get('state_key')}, "
f"outlier={self.internal_metadata.is_outlier()}"
">"
)