Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

logging_config

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) -> bool

Check if a message with given level should be logged.

Parameters:

NameTypeDescription
levelminto.logging_config.LogLevelThe log level to check.

Returns:

TypeDescription
boolTrue 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) -> str

Format a log message according to configuration.

Parameters:

NameTypeDescription
levelminto.logging_config.LogLevelLog level of the message.
messagestrThe message content.
indent_levelintIndentation level (0 = experiment, 1 = run, 2 = operation).
icon_typetyping.OptionalType of icon to use (optional).

Returns:

TypeDescription
strFormatted message string.
truncate_value
truncate_value(value: typing.Any) -> str

Truncate a value for display if it’s too long.

Parameters:

NameTypeDescription
valuetyping.AnyThe value to truncate.

Returns:

TypeDescription
strString representation of the value, possibly truncated.
format_memory_size
format_memory_size(bytes_size: int) -> str

Format memory size in human-readable format.

Parameters:

NameTypeDescription
bytes_sizeintSize in bytes.

Returns:

TypeDescription
strFormatted string (e.g., “8.0 GB”).
format_environment_summary
format_environment_summary(env_info: dict) -> str

Format a brief summary of environment information.

Parameters:

NameTypeDescription
env_infodictDictionary containing environment information.

Returns:

TypeDescription
strFormatted summary string.
format_environment_info
format_environment_info(env_info: dict, indent_level: int = 1) -> list

Format full environment details for logging.

Parameters:

NameTypeDescription
env_infodictDictionary containing environment information.
indent_levelintIndentation level for formatting.

Returns:

TypeDescription
listList of formatted strings, one per line.