def setup_file_logger(log_file, log_level='error', log_format='%(asctime)s,%(msecs)03d [%(levelname)-5s] [%(name)s:%(lineno)d]  %(message)s', date_format='%Y-%m-%d %H:%M:%S', max_bytes=100000000, backup_count=1):
    '\n    Sets up logging to a file. By default will auto-rotate those logs every\n    100MB and keep one backup.\n    '
    _remove_temp_handler()
    rootlogger = logging.getLogger()
    handler = logging.handlers.RotatingFileHandler(log_file, maxBytes=max_bytes, backupCount=backup_count)
    handler.setLevel(LOG_LEVELS.get(log_level, logging.ERROR))
    formatter = logging.Formatter(log_format, date_format)
    handler.setFormatter(formatter)
    rootlogger.addHandler(handler)
Sets up logging to a file. By default will auto-rotate those logs every
100MB and keep one backup.
def setup_file_logger(log_file, log_level='error', log_format='%(asctime)s,%(msecs)03d [%(levelname)-5s] [%(name)s:%(lineno)d]  %(message)s', date_format='%Y-%m-%d %H:%M:%S', max_bytes=100000000, backup_count=1):
    '\n    Sets up logging to a file. By default will auto-rotate those logs every\n    100MB and keep one backup.\n    '
    _remove_temp_handler()
    rootlogger = logging.getLogger()
    handler = logging.handlers.RotatingFileHandler(log_file, maxBytes=max_bytes, backupCount=backup_count)
    handler.setLevel(LOG_LEVELS.get(log_level, logging.ERROR))
    formatter = logging.Formatter(log_format, date_format)
    handler.setFormatter(formatter)
    rootlogger.addHandler(handler)