tardis.io.logger.logger module¶
- class tardis.io.logger.logger.LogFilter(log_levels)[source]¶
Bases:
object
Filter for controlling which log levels are displayed.
- Parameters:
- log_levelslist
List of logging levels to allow through the filter.
- class tardis.io.logger.logger.LoggingConfig(LEVELS: dict = <factory>, COLORS: dict = <factory>)[source]¶
Bases:
object
Logging configuration.
- Attributes:
- LEVELSdict
The logging levels.
- COLORSdict
The logging colors.
- DEFAULT_LEVELstr
The default logging level.
- DEFAULT_SPECIFIC_STATEbool
The default specific log level state.
- DEFAULT_LEVEL = 'INFO'¶
- DEFAULT_SPECIFIC_STATE = False¶
- class tardis.io.logger.logger.PanelWidgetLogHandler(log_outputs, colors, display_widget=True, display_handle=None, logger_widget=None)[source]¶
Bases:
Handler
Log handler for logging to a widget.
Handles the formatting and display of log messages in Panel widgets.
- Parameters:
- log_outputsdict
Dictionary of Panel HTML panes for different log levels.
- colorsdict
Dictionary mapping log levels to display colors.
- display_widgetbool, optional
Whether to display logs in the widget. Defaults to True.
- display_handleIPython.display.DisplayHandle, optional
Handle for updating the display in Jupyter environment.
- logger_widgetpanel.Tabs, optional
The Panel Tabs widget containing the log outputs.
Initializes the instance - basically setting the formatter to None and the filter list to empty.
- class tardis.io.logger.logger.TARDISLogger(display_handle=None, logger_widget=None, log_outputs=None)[source]¶
Bases:
object
Main logger class for TARDIS.
Handles configuration of logging levels, filters, and outputs.
- Parameters:
- display_handleIPython.display.DisplayHandle, optional
Handle for updating the display in Jupyter environment.
- logger_widgetpanel.Tabs, optional
The Panel Tabs widget containing the log outputs.
- log_outputsdict, optional
Dictionary of Panel HTML panes for different log levels.
- configure_logging(log_level, tardis_config, specific_log_level=None)[source]¶
Configure the logging level and filtering for TARDIS loggers.
- Parameters:
- log_levelstr
The logging level to use (e.g., “INFO”, “DEBUG”).
- tardis_configdict
Configuration dictionary containing debug settings.
- specific_log_levelbool, optional
Whether to enable specific log level filtering.
- Raises:
- ValueError
If an invalid log_level is provided.
- tardis.io.logger.logger.create_output_widget(height=300)[source]¶
Create an HTML pane for logging output.
- Parameters:
- heightint, optional
The height of the pane in pixels.
- Returns:
- panel.pane.HTML
A Panel HTML pane configured for logging output.
- tardis.io.logger.logger.get_environment()[source]¶
Determine the execution environment.
Panel behaves differently in vscode and jupyter. In jupyter, the logger widget’s display handle has to be updated after each log entry. In vscode, this is not needed.
- Returns:
- str
The environment name.
- tardis.io.logger.logger.logging_state(log_level, tardis_config, specific_log_level=None, display_logging_widget=True)[source]¶
Configure and initialize the TARDIS logging system.
Sets up the logging environment, configures log levels, and displays the logging widget if requested.
- Parameters:
- log_levelstr
The logging level to use (e.g., “INFO”, “DEBUG”).
- tardis_configdict
Configuration dictionary containing debug settings.
- specific_log_levelbool, optional
Whether to enable specific log level filtering.
- display_logging_widgetbool, optional
Whether to display the logging widget. Default is True.
- Returns:
- panel.Tabs or None
The logger widget if display_logging_widget is True and in a supported environment, otherwise None.