format-multiline-log-fix
All checks were successful
Deploy to core / deploy (push) Successful in 1m10s

This commit is contained in:
Untone 2024-02-20 19:42:14 +03:00
parent 333340056e
commit abc752c629

View File

@ -38,14 +38,19 @@ class MultilineColoredFormatter(colorlog.ColoredFormatter):
formatted_lines = []
for line in lines:
# Format each line with the provided format
formatted_lines.append(super().format(record, line))
formatted_lines.append(self._format_line(record, line))
# Join the formatted lines
return '\n'.join(formatted_lines)
else:
# If not multiline or no message, use the default formatting
return super().format(record)
# Create a ColoredFormatter object for colorized logging
def _format_line(self, record, line):
# Format each line with the provided format
return super().format(record, line)
# Create a MultilineColoredFormatter object for colorized logging
formatter = MultilineColoredFormatter(fmt_string, **fmt_config)
# Create a stream handler for logging output