Logger¶

labml.logger.log(*args, is_new_line: bool = True, is_reset: bool = True)[source]¶

This has multiple overloads

labml.logger.log(message: str, *, is_new_line=True)[source]
labml.logger.log(message: str, color: StyleCode, *, is_new_line=True)[source]
labml.logger.log(message: str, colors: List[StyleCode], *, is_new_line=True)[source]
labml.logger.log(messages: List[Union[str, Tuple[str, StyleCode]]], *, is_new_line=True)[source]
labml.logger.log(*args: Union[str, Tuple[str, StyleCode]], is_new_line: bool = True)[source]
Parameters
  • message (str) – string to be printed

  • color (StyleCode) – color/style of the message

  • colors (List[StyleCode]) – list of colors/styles for the message

  • args (Union[str, Tuple[str, StyleCode]]) – list of messages Each element should be either a string or a tuple of string and styles.

  • messages (List[Union[str, Tuple[str, StyleCode]]]) – a list of messages. Each element should be either a string or a tuple of string and styles.

Keyword Arguments

is_new_line (bool) – whether to print a new line at the end

Example::
>>> logger.log("test")
labml.logger.inspect(*args, **kwargs)[source]¶

Pretty prints a set of values.

This has multiple overloads

labml.logger.inspect(items: Dict)[source]
labml.logger.inspect(items: List)[source]
labml.logger.inspect(*items: any)[source]
class labml.logger.Text[source]¶

Standard styles we use in labml

danger = 'red'¶
heading = 'underline'¶
highlight = ['bold', 'orange']¶
key = 'cyan'¶
meta = 'blue'¶
meta2 = 'purple'¶
none = None¶
subtle = ['light', 'white']¶
success = 'green'¶
title = ['bold', 'underline']¶
value = 'bold'¶
warning = 'orange'¶
class labml.logger.Style[source]¶

Output styles

bold = 'bold'¶
light = 'light'¶
none = None¶
normal = 'normal'¶
underline = 'underline'¶
class labml.logger.Color[source]¶

Output colors

black = 'black'¶
blue = 'blue'¶
cyan = 'cyan'¶
green = 'green'¶
none = None¶
orange = 'orange'¶
purple = 'purple'¶
red = 'red'¶
white = 'white'¶
class labml.logger.StyleCode[source]¶

This is the base class for different style enumerations