Skip to content

Commit

Permalink
chore: add doc around getMessageReplaced
Browse files Browse the repository at this point in the history
Signed-off-by: Samuel Anderson <[email protected]>
  • Loading branch information
AWS-Samuel committed Oct 22, 2024
1 parent a3cd28a commit c229ca7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/deadline_worker_agent/log_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,8 @@ def filter(self, record: logging.LogRecord) -> bool:
if isinstance(record.msg, str):
message = record.getMessage()
record.msg = StringLogEvent(message)
# We must replace record.getMessage() so that a string is returned and not the LogEvent type.
# getMessageReplaced is used to indicate we already have done so, to avoid replacing twice.
record.getMessageReplaced = True
record.getMessage = MethodType(lambda self: self.msg.getMessage(), record) # type: ignore
record.args = None
Expand Down

0 comments on commit c229ca7

Please sign in to comment.