Merge pull request #9271 from thisch/unpack

Inline PercentStyleMultiline._update_message
This commit is contained in:
Thomas Hisch 2021-11-08 12:54:44 +01:00 committed by GitHub
commit 59373fe402
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 9 deletions

View File

@ -118,14 +118,6 @@ class PercentStyleMultiline(logging.PercentStyle):
super().__init__(fmt)
self._auto_indent = self._get_auto_indent(auto_indent)
@staticmethod
def _update_message(
record_dict: Dict[str, object], message: str
) -> Dict[str, object]:
tmp = record_dict.copy()
tmp["message"] = message
return tmp
@staticmethod
def _get_auto_indent(auto_indent_option: Union[int, str, bool, None]) -> int:
"""Determine the current auto indentation setting.
@ -191,7 +183,7 @@ class PercentStyleMultiline(logging.PercentStyle):
if auto_indent:
lines = record.message.splitlines()
formatted = self._fmt % self._update_message(record.__dict__, lines[0])
formatted = self._fmt % {**record.__dict__, "message": lines[0]}
if auto_indent < 0:
indentation = _remove_ansi_escape_sequences(formatted).find(