ironik.util package

Submodules

ironik.util.exceptions module

author

Jonathan Decker

exception ironik.util.exceptions.IronikFatalError(message)[source]

Bases: Exception

Exception for irrecoverable errors that should lead to program termination.

exception ironik.util.exceptions.IronikPassingError(message)[source]

Bases: Exception

Exception for recoverable errors that should not lead to program termination.

ironik.util.exceptions.passing_error_handler(func)[source]

Decorator for functions that can throw an IronikPassingError such that the IronikPassingError is caught and printed. :param func:

Returns:

ironik.util.ironik_logger module

Offers logging utilities for the entire program. Should be imported in every file as

“logger = logging.getLogger(“logger”)”

author

Jonathan Decker

ironik.util.ironik_logger.setup_logger(logger_name='logger', console_level=50, log_file_level=20, logs_to_keep=20, create_log_files=True, path_to_logs=None)[source]
Description

Sets up a logger with formatting, log file creation, settable console and log file logging levels as well as automatic deletion of old log files.

Parameters
  • logger_name (str) – Name of the logger profile, standard is logger, this should not be changed except for testing

  • console_level (logging level) – logging level on console, standard is INFO

  • log_file_level (logging level) – logging level in log file, standard is DEBUG

  • logs_to_keep (int) – number of log files to keep before deleting the oldest one, standard is 20

  • create_log_files (bool) – Whether to create log files or only log to console

  • path_to_logs (pathlib.PATH) – path to the directory for saving the logs, standard is current working directory / logs

Returns

None, but the logger may now be accessed via logging.getLogger(logger_name), standard is logger

Return type

None

Module contents