Skip to content

Commit

Permalink
fix(logger): push extra keys to the end (#722)
Browse files Browse the repository at this point in the history
  • Loading branch information
heitorlessa committed Oct 1, 2021
1 parent 1845053 commit 610f569
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion aws_lambda_powertools/logging/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def _extract_log_keys(self, log_record: logging.LogRecord) -> Dict[str, Any]:
record_dict["asctime"] = self.formatTime(record=log_record, datefmt=self.datefmt)
extras = {k: v for k, v in record_dict.items() if k not in RESERVED_LOG_ATTRS}

formatted_log = {**extras}
formatted_log = {}

# Iterate over a default or existing log structure
# then replace any std log attribute e.g. '%(level)s' to 'INFO', '%(process)d to '4773'
Expand All @@ -233,6 +233,7 @@ def _extract_log_keys(self, log_record: logging.LogRecord) -> Dict[str, Any]:
else:
formatted_log[key] = value

formatted_log.update(**extras)
return formatted_log

@staticmethod
Expand Down

0 comments on commit 610f569

Please sign in to comment.