src.logging.logger

A logger that logs to the terminal.

Functions

log_exception(exc_type, exc_value, exc_traceback)

Log any uncaught exceptions except KeyboardInterrupts.

Classes

Logger()

A logger that logs to the terminal.

src.logging.logger.log_exception(exc_type, exc_value, exc_traceback)[source]

Log any uncaught exceptions except KeyboardInterrupts.

Based on https://stackoverflow.com/a/16993115.

Parameters:
  • exc_type (type[BaseException]) – The type of the exception.

  • exc_value (BaseException) – The exception instance.

  • exc_traceback (TracebackType | None) – The traceback.

Return type:

None

class src.logging.logger.Logger[source]

A logger that logs to the terminal.

To use this logger, inherit, this will make the following methods available: - log_to_terminal(message: str) -> None - log_to_debug(message: str) -> None - log_to_warning(message: str) -> None - log_to_external(message: dict[str, Any], **kwargs: Never) -> None - external_define_metric(metric: str, metric_type: str) -> None

log_to_terminal(message)[source]

Log a message to the terminal.

Parameters:

message (str) – The message to log.

Return type:

None

log_to_debug(message)[source]

Log a message to the debug level.

Parameters:

message (str) – The message to log.

Return type:

None

log_to_warning(message)[source]

Log a message to the warning level.

Parameters:

message (str) – The message to log.

Return type:

None

log_to_external(message, **kwargs)[source]

Log a message to an external service.

Parameters:
  • message (dict[str, Any]) – The message to log.

  • kwargs (Never) – Any additional arguments (UNUSED).

Return type:

None

external_define_metric(metric, metric_type)[source]

Define a metric in an external service.

Parameters:
  • metric (str) – The metric to define

  • metric_type (str) – The type of the metric

Return type:

None

log_section_separator(message)[source]

Log section separator method, if no logging override with empty.

Parameters:

message (str) – The message to log.

Return type:

None