コード例 #1
0
def change_LOG_DIR(log_dir, web_log):
    """
    Change logging directory for application and webserver

    :param log_dir: Path to new logging directory
    :param web_log: Enable/disable web logging
    :return: True on success, False on failure
    """
    log_dir_changed = False
    abs_log_dir = ek(os.path.normpath,
                     ek(os.path.join, sickbeard.DATA_DIR, log_dir))
    web_log_value = checkbox_to_value(web_log)

    if ek(os.path.normpath, sickbeard.LOG_DIR) != abs_log_dir:
        if helpers.makeDir(abs_log_dir):
            sickbeard.ACTUAL_LOG_DIR = ek(os.path.normpath, log_dir)
            sickbeard.LOG_DIR = abs_log_dir

            logger.init_logging()
            logger.log(u"Initialized new log file in " + sickbeard.LOG_DIR)
            log_dir_changed = True

        else:
            return False

    if sickbeard.WEB_LOG != web_log_value or log_dir_changed is True:
        sickbeard.WEB_LOG = web_log_value

    return True
コード例 #2
0
ファイル: config.py プロジェクト: ratoaq2/SickRage
def change_LOG_DIR(log_dir, web_log):
    """
    Change logging directory for application and webserver

    :param log_dir: Path to new logging directory
    :param web_log: Enable/disable web logging
    :return: True on success, False on failure
    """
    log_dir_changed = False
    abs_log_dir = ek(os.path.normpath, ek(os.path.join, sickbeard.DATA_DIR, log_dir))
    web_log_value = checkbox_to_value(web_log)

    if ek(os.path.normpath, sickbeard.LOG_DIR) != abs_log_dir:
        if helpers.makeDir(abs_log_dir):
            sickbeard.ACTUAL_LOG_DIR = ek(os.path.normpath, log_dir)
            sickbeard.LOG_DIR = abs_log_dir

            logger.init_logging()
            logger.log(u"Initialized new log file in " + sickbeard.LOG_DIR)
            log_dir_changed = True

        else:
            return False

    if sickbeard.WEB_LOG != web_log_value or log_dir_changed is True:
        sickbeard.WEB_LOG = web_log_value

    return True