rex.utilities.loggers.init_logger

init_logger(logger_name, stream=True, log_level='INFO', log_file=None, log_format='%(levelname)s - %(asctime)s [%(filename)s:%(lineno)d] : %(message)s', prune=True)[source]

Starts logging instance and adds logging attributes to LOGGERS

Parameters:
  • logger_name (str) – Name of logger to initialize

  • stream (bool, optional) – Add a StreamHandler along with FileHandler, by default True

  • log_level (str, optional) – Level of logging to capture, must be key in LOG_LEVEL. If multiple handlers/log_files are requested in a single call of this function, the specified logging level will be applied to all requested handlers, by default “INFO”

  • log_file (str | list, optional) – Path to file to use for logging, if None use a StreamHandler list of multiple handlers is permitted, by default None

  • log_format (str, optional) – Format for loggings, by default FORMAT

  • prune (bool, optional) – Remove child logger handlers if parent logger is added, parent will inherit child’s handlers, by default True

Returns:

logger (logging.logger) – logging instance that was initialized