rex.utilities.loggers.setup_logger

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

Setup logging instance with given name and attributes

Parameters:
  • logger_name (str) – Name of logger

  • 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

Returns:

logger (logging.logger) – instance of logger for given name, with given level and added handler