log_multiline#
- lumopt2.utils.common.log_multiline(target_logger: Logger, level: int, message: str) None#
Log a multi-line
messageso every line gets the formatter prefix.Python’s
logging.Formatteris invoked once per record and only prepends timestamp / level / logger-name to the first line of the message. Continuation lines therefore render bare on the console and – crucially – can be wider than the terminal, in which case the terminal’s own line wrapping further mangles them (e.g. dropping the leading[of an array dump and tucking the first value onto the previous record’s line).This helper splits
messageon newlines and emits one log record per line, so every line gets its own uniform prefix and long output stays readable regardless of terminal width. An empty string still produces exactly one (empty) record so the call site does not silently drop output.- Parameters:
- target_logger
logging.Logger Logger to emit on.
- level
int Log level for every emitted record (e.g.
logging.INFO).- message
str The (possibly multi-line) message to log.
- target_logger