pelagos_py.utils.console#

class pelagos_py.utils.console.ConsoleFormatter(*args, stream=None, **kwargs)[source]#

Bases: logging.Formatter

Reshape a record to time  name  message and colour it by severity.

Name comes from the [...] tag when present, else the logger name. WARNING yellow, SEVERE amber, ERROR/STOP red. Pass extra={"raw": True} to emit a line verbatim.

format(record)[source]#

Format the specified record as text.

The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.

pelagos_py.utils.console.make_console_handler(level=logging.INFO)[source]#

Build the pipeline’s console handler: compact, coloured, tqdm-aware.

pelagos_py.utils.console.progress_bar(iterable=None, *, desc='', total=None, unit='it', leave=False, logger=None, step_name=None)[source]#

A tqdm bar in the pipeline’s standard style for every countable loop.

step_name adds the time  name prefix; logger also writes a one-line summary to the file. Auto-disables off a terminal.