code: def init_rotating_logger(level, logfile, max_files, max_bytes):
    
    logging.basicConfig()
  
    root_logger = logging.getLogger()
    log_format = "[%(asctime)s] [%(levelname)s] %(filename)s: %(message)s"
  
    root_logger.setLevel(level)
    handler = RotatingFileHandler(logfile, maxBytes=max_bytes, backupCount=max_files)
    handler.setFormatter(logging.Formatter(fmt=log_format, datefmt=date_format))
    root_logger.addHandler(handler)
  
    for handler in root_logger.handlers:
      root_logger.debug("Associated handlers - " + str(handler))
      if isinstance(handler, logging.StreamHandler):
        root_logger.debug("Removing StreamHandler: " + str(handler))
        root_logger.handlers.remove(handler)
docs: Initializes a rotating logger
  
    It also makes sure that any StreamHandler is removed, so as to avoid stdout/stderr
    constipation issues