def enable_logfile(logger, logfile, level='info'):
    '''

    :param logger: 日志
    :param logfile: 日志文件路径
    :param level: 日志等级
    :return:
    '''
    if isinstance(logger, str):
        logger = logging.getLogger(logger)

    Formatter = logging.Formatter(_DEFAULT_LOG_FORMAT)
    Rthandler = RotatingFileHandler(logfile, maxBytes=5 * 1024 * 1024, backupCount=7)
    Rthandler.setFormatter(Formatter)
    Rthandler.setLevel(level.upper())
    logger.addHandler(Rthandler)
    return logger
def enable_logfile ( logger , logfile , level = 'info' ) : if isinstance ( logger , str ) : logger = logging . getLogger ( logger ) Formatter = logging . Formatter ( _DEFAULT_LOG_FORMAT ) Rthandler = RotatingFileHandler ( logfile , maxBytes = 5 * 1024 * 1024 , backupCount = 7 ) Rthandler . setFormatter ( Formatter ) Rthandler . setLevel ( level . upper ( ) ) logger . addHandler ( Rthandler ) return logger
:param logger: 日志
    :param logfile: 日志文件路径
    :param level: 日志等级
    :return: