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.

filter(log_record)[source]

Determine if a log record should be displayed.

Parameters:
log_recordlogging.LogRecord

The log record to evaluate.

Returns:
bool

True if the record’s level is in the allowed levels, False otherwise.

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.

COLORS: dict
DEFAULT_LEVEL = 'INFO'
DEFAULT_SPECIFIC_STATE = False
LEVELS: dict
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.

close()[source]

Close the log handler.

emit(record)[source]

Process and emit a log record.

Parameters:
recordlogging.LogRecord

The log record to process and display.

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.

remove_widget_handler()[source]

Remove the widget handler from the logger.

setup_stream_handler()[source]

Set up notebook-based logging after widget handler is removed.

setup_widget_logging(display_widget=True)[source]

Set up widget-based logging interface.

Parameters:
display_widgetbool, optional

Whether to display the widget in GUI environments. Default is True.

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.