Logger¶
Here is a tutorial on Google Colab that shows how to use the logger module
- labml.logger.log()[source]¶
- labml.logger.log(message: str, *, is_new_line: bool = True, is_reset: bool = True)
- labml.logger.log(message: str, color: StyleCode, *, is_new_line: bool = True, is_reset: bool = True)
- labml.logger.log(message: str, colors: List[StyleCode], *, is_new_line: bool = True, is_reset: bool = True)
- labml.logger.log(messages: List[str | Tuple[str, StyleCode]], *, is_new_line: bool = True, is_reset: bool = True)
- labml.logger.log(*args: str | Tuple[str, StyleCode], is_new_line: bool = True, is_reset: bool = True)
This has multiple overloads
- labml.logger.log(message: str, *, is_new_line=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(items: Dict, _expand: bool = False, _n: int = 10)[source]¶
- labml.logger.inspect(items: List, _expand: bool = False, _n: int = 10)
- labml.logger.inspect(*items: any, _expand: bool = False, _n: int = 10)
- labml.logger.inspect(**items: any)
Pretty prints a set of values.
This has multiple overloads
- labml.logger.inspect(items: Dict, _expand: bool = False, _n: int = 10)[source]
- labml.logger.inspect(items: List, _expand: bool = False, _n: int = 10)[source]
- labml.logger.inspect(*items: any, _expand: bool = False, _n: int = 10)[source]
- labml.logger.inspect(**items: any, _expand: bool = False, _n: int = 10)[source]
- Keyword Arguments:
_expand (bool) – whether to expand items
_n (int) – number of items to show. -1 for all
Styling¶
- class labml.logger.Text(value)[source]¶
Standard styles we use in labml
- danger = 'red'¶
- heading = 'underline'¶
- highlight = ['bold', 'orange']¶
- key = 'cyan'¶
- link = 'link'¶
- meta = 'blue'¶
- meta2 = 'purple'¶
- none = None¶
- subtle = ['light', 'white']¶
- success = 'green'¶
- title = ['bold', 'underline']¶
- warning = 'orange'¶
- class labml.logger.Style(value)[source]¶
Output styles
- bold = 'bold'¶
- light = 'light'¶
- none = None¶
- normal = 'normal'¶
- underline = 'underline'¶