minto.logging_config
Logging configuration module for Minto.
This module provides logging configuration and management utilities for experiment and run execution monitoring.
Classes¶
LogLevel¶
LogLevel()Log level enumeration.
LogFormat¶
LogFormat()Log format enumeration.
LogConfig¶
LogConfig(enabled: bool = True, level: minto.logging_config.LogLevel = LogLevel.INFO, format: minto.logging_config.LogFormat = LogFormat.SIMPLE, show_timestamps: bool = True, show_icons: bool = True, show_colors: bool = True, indent_size: int = 2, max_parameter_length: int = 100)Configuration class for logging settings.
This class manages logging behavior including verbosity levels, output formats, and display options.
Methods¶
should_log¶
should_log(level: minto.logging_config.LogLevel) -> boolCheck if a message with given level should be logged.
Parameters:
| Name | Type | Description |
|---|---|---|
level | minto.logging_config.LogLevel | The log level to check. |
Returns:
| Type | Description |
|---|---|
bool | True if the message should be logged, False otherwise. |
LogFormatter¶
LogFormatter(config: minto.logging_config.LogConfig)Formatter for log messages.
This class handles the formatting of log messages according to the specified configuration.
Methods¶
format_message¶
format_message(level: minto.logging_config.LogLevel, message: str, indent_level: int = 0, icon_type: typing.Optional = None) -> strFormat a log message according to configuration.
Parameters:
| Name | Type | Description |
|---|---|---|
level | minto.logging_config.LogLevel | Log level of the message. |
message | str | The message content. |
indent_level | int | Indentation level (0 = experiment, 1 = run, 2 = operation). |
icon_type | typing.Optional | Type of icon to use (optional). |
Returns:
| Type | Description |
|---|---|
str | Formatted message string. |
truncate_value¶
truncate_value(value: typing.Any) -> strTruncate a value for display if it’s too long.
Parameters:
| Name | Type | Description |
|---|---|---|
value | typing.Any | The value to truncate. |
Returns:
| Type | Description |
|---|---|
str | String representation of the value, possibly truncated. |
format_memory_size¶
format_memory_size(bytes_size: int) -> strFormat memory size in human-readable format.
Parameters:
| Name | Type | Description |
|---|---|---|
bytes_size | int | Size in bytes. |
Returns:
| Type | Description |
|---|---|
str | Formatted string (e.g., “8.0 GB”). |
format_environment_summary¶
format_environment_summary(env_info: dict) -> strFormat a brief summary of environment information.
Parameters:
| Name | Type | Description |
|---|---|---|
env_info | dict | Dictionary containing environment information. |
Returns:
| Type | Description |
|---|---|
str | Formatted summary string. |
format_environment_info¶
format_environment_info(env_info: dict, indent_level: int = 1) -> listFormat full environment details for logging.
Parameters:
| Name | Type | Description |
|---|---|---|
env_info | dict | Dictionary containing environment information. |
indent_level | int | Indentation level for formatting. |
Returns:
| Type | Description |
|---|---|
list | List of formatted strings, one per line. |