def __init__(self, level_log): """load bank holidays 2018 end year """ self.logger = Logger(self.__class__.__name__, level_log).get() self.bank_holidays.append([2018, 5, 7]) self.bank_holidays.append([2018, 6, 4]) self.bank_holidays.append([2018, 8, 6]) self.bank_holidays.append([2018, 10, 29]) self.bank_holidays.append([2018, 12, 25]) self.bank_holidays.append([2018, 12, 26]) self.bank_holidays.append([2018, 12, 27])
def __init__(self, file_config, level_log): self.level_log = level_log self.logger = Logger(self.__class__.__name__, level_log).get() try: self.config = json.loads(open(file_config, "r").read()) self.mongodbaccess = MongoDBAccess(self.config, level_log) except IOError: self.logger.error("File Error: %s", file_config) self.config = {} self.mongodbaccess = MongoDBAccess({}, level_log) self.logger.info("Inicio: %s", datetime.datetime.now())
def test_logger_test(): """Test logger""" sys.path.insert(0, "../test") try: os.remove("log/test.log") except OSError: print "file don't exist" logger = Logger("test", "DEBUG").get() logger.error("Error") data = open("log/test.log", "r").read() assert " ERROR:log_namespace.test Error" in data
def __init__(self, config, levelLog): """Need a file where has got all parameters and level of Loggin""" self.logger = Logger(self.__class__.__name__, levelLog).get() self.logger.setLevel('INFO') try: self.logger.debug(config.get("url", "")) self._client = MongoClient(config.get("url", "")) self.db_access = self._client[config.get("nameDB")] self.logger.info("-- INFO -- DATA BASE CONECT OK") except ConfigurationError: self.logger.error("ConfigurationErr") except ConnectionFailure: self.logger.error("ConnectionFailure") except OperationFailure: self.logger.error("Authentication failure")
def __init__(self, mongo_db_access, level_log): self.logger = Logger(self.__class__.__name__, level_log).get() self.mongodbaccess = mongo_db_access self.logger.info("Inicio: %s", datetime.datetime.now())
def __init__(self, config, level_log): self.logger = Logger(self.__class__.__name__, level_log).get() self.config = config
def __init__(self, config, mongo_db_access, level_log): self.logger = Logger(self.__class__.__name__, level_log).get() self.mongodbaccess = mongo_db_access self.seleniumaccess = SeleniumAccess(config, level_log) self.holidays = Holidays(level_log) self.logger.info("Inicio: %s", datetime.datetime.now())
def __init__(self, mongodbaccess, level_log): """ Build urls to review """ self.logger = Logger(self.__class__.__name__, level_log).get() self.holidays = Holidays(level_log) self.mongodbaccess = mongodbaccess