Exemple #1
0
    def __init__(self):
        self.name = None
        self.path = None
        self.base_path = None
        if cfg.paths.storage_path:
            self.path = cfg.paths.storage_path
            self.base_path = cfg.paths.storage_path
        else:
            self.path = os.path.join(expanduser("~"), '.viper')
            self.base_path = os.path.join(expanduser("~"), '.viper')

        if not os.path.exists(self.path):
            os.makedirs(self.path)

        # initalize default log settings
        log_file = os.path.join(self.base_path, "viper.log")
        debug_log = False

        if hasattr(cfg, 'logging'):
            if hasattr(cfg.logging, 'log_file') and cfg.logging.log_file:
                log_file = cfg.logging.log_file

            if hasattr(cfg.logging, 'debug'):
                debug_log = cfg.logging.debug

        init_logger(log_file_path=log_file, debug=debug_log)
        log.debug("logger initiated")
Exemple #2
0
    def __init__(self):
        self.name = None
        self.path = None
        self.base_path = None
        if cfg.paths.storage_path:
            self.path = cfg.paths.storage_path
            self.base_path = cfg.paths.storage_path
        else:
            self.path = os.path.join(expanduser("~"), '.viper')
            self.base_path = os.path.join(expanduser("~"), '.viper')

        if not os.path.exists(self.path):
            os.makedirs(self.path)

        # initialize default log settings
        log_file = os.path.join(self.base_path, "viper.log")
        debug_log = False

        if hasattr(cfg, 'logging'):
            if hasattr(cfg.logging, 'log_file') and cfg.logging.log_file:
                log_file = cfg.logging.log_file

            if hasattr(cfg.logging, 'debug'):
                debug_log = cfg.logging.debug

        init_logger(log_file_path=log_file, debug=debug_log)
        log.debug("logger initiated")
Exemple #3
0
    def __init__(self):
        self.name = None
        self.path = None
        self.base_path = None
        if cfg.paths.storage_path:
            self.path = cfg.paths.storage_path
            self.base_path = cfg.paths.storage_path
        else:
            self.path = os.path.join(expanduser("~"), '.viper')
            self.base_path = os.path.join(expanduser("~"), '.viper')

        if not os.path.exists(self.path):
            os.makedirs(self.path)

        if cfg.logging.log_file:
            log_file = cfg.logging.log_file
        else:
            log_file = os.path.join(self.base_path, "viper.log")
        init_logger(log_file_path=log_file, debug=cfg.logging.debug)
        log.debug("logger initiated")