mlrl.testbed.log package

Author Michael Rapp (michael.rapp.ml@gmail.com)

Provides classes that allow writing log messages.

class mlrl.testbed.log.Log

Bases: object

Allows to write log messages.

static error(message: str | ConsoleRenderable, error: Exception | None = None, box: bool = False, box_title: str | None = None, highlight: bool = False)

Writes a log message at level Log.Level.ERROR and terminates the build system.

Parameters:
  • message – The log message to be written

  • error – An optional error to be included in the log message

  • box – True, if a box should be surrounded by a box, False otherwise

  • box_title – An optional title to be printed at the top of the box surrounding the log message

  • highlight – True, if certain values in the log message should be highlighted, False otherwise

static indented()

A context manager that indents all log messages emitted within the block. Nesting multiple context managers results in deeper indentation levels.

static info(message: str | ConsoleRenderable, box: bool = False, box_title: str | None = None, highlight: bool = False)

Writes a log message at level Log.Level.INFO.

Parameters:
  • message – The log message to be written

  • box – True, if a box should be surrounded by a box, False otherwise

  • box_title – An optional title to be printed at the top of the box surrounding the log message

  • highlight – True, if certain values in the log message should be highlighted, False otherwise

static separator(title: str)

Writes a log messages that acts as a separator with a specific title.

Parameters:

title – The title to be used

static source_code(source_code: str, language: str, box_title: str | None = None)

Writes a log message containing source code in a specific language at level Log.Level.INFO.

Parameters:
  • source_code – The source code to be written

  • language – The language used by the source code

  • box_title – An optional title to be printed at the top of the box surrounding the log message

static success(message: str, box: bool = False, box_title: str | None = None, highlight: bool = False)

Writes a log message at level Log.Level.INFO indicating successful operation of an operation.

Parameters:
  • message – The log message to be written

  • box – True, if a box should be surrounded by a box, False otherwise

  • box_title – An optional title to be printed at the top of the box surrounding the log message

  • highlight – True, if certain values in the log message should be highlighted, False otherwise

static verbose(message: str | ConsoleRenderable, box: bool = False, box_title: str | None = None, highlight: bool = False)

Writes a log message at level Log.Level.VERBOSE.

Parameters:
  • message – The log message to be written

  • box – True, if a box should be surrounded by a box, False otherwise

  • box_title – An optional title to be printed at the top of the box surrounding the log message

  • highlight – True, if certain values in the log message should be highlighted, False otherwise

static warning(message: str | ConsoleRenderable, box: bool = False, box_title: str | None = None, highlight: bool = False)

Writes a log message at level Log.Level.WARNING.

Parameters:
  • message – The log message to be written

  • box – True, if a box should be surrounded by a box, False otherwise

  • box_title – An optional title to be printed at the top of the box surrounding the log message

  • highlight – True, if certain values in the log message should be highlighted, False otherwise

mlrl.testbed.log.disable_log()

Prevents any output from being written to stdout or stderr.

Submodules