Closed
Description
Right now the log handler has a fixed format:
def format(self, record: LogRecord) -> str:
"""Generate a timestamped message.
:param record: The record (message object) to be logged
"""
return f"{record.created:<0.3f}: {record.levelname} - {record.msg}"
The only way to customize this format is to subclass the handler. It would be more convienient to just be able to set the format string at the time the handler is initialized, eg:
log_handler = StreamHandler(format_str="[%(asctime)s] %(levelname)s: %(message)s")
Better yet, it would be nice to just mimic the way python does formatters:
formatter = logging.Formatter(fmt="[%(asctime)s] %(levelname)s: %(message)s")
log_handler = StreamHandler(fmt=formatter)
Metadata
Metadata
Assignees
Labels
No labels