sci_watch.utils.logger module
- sci_watch.utils.logger.get_logger(logger_name: str, level: Literal['NOTSET', 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'FATAL', 'CRITICAL'] = 'INFO', log_file_path: Optional[Union[str, PathLike]] = None) Logger [source]
Logger getter function.
- Parameters:
logger_name (str) – Should be name of the file importing the logger
level (str) – Minimum level of logging
- Returns:
A ready to use logger object
- Return type:
Logger
- sci_watch.utils.logger.logging_wrapper(logger: Logger) Callable [source]
Wrap an entire function in a try / except block in order to catch and log any Exception; such exceptions are propagated to the caller.
- Parameters:
logger (logging.Logger) – The logger to use for logging raised exceptions.
- Returns:
The decorated function wrapped in a try / except block with error propagation.
- Return type:
callable