def test_basic_logging_log(self): sys.stdout = StringIO() self._collector = Collector() sh = StreamHandler(sys.stdout) sh.setFormatter(DEFAULT_FORMATTER) alignak_logger.handlers = [] alignak_logger.addHandler(sh) alignak_logger.load_obj(self._collector) alignak_logger.log_set = True alignak_logger.setLevel(DEBUG) self.generic_tst(lambda x: naglog_result('info', x), 'Some log-message', [1, 1], [r'^\[\d+\] Some log-message\n$', r'^\[\d+\] Some log-message$'])
def test_basic_logging_log(self): sys.stdout = StringIO() self._collector = Collector() sh = StreamHandler(sys.stdout) sh.setFormatter(DEFAULT_FORMATTER) alignak_logger.handlers = [] alignak_logger.addHandler(sh) alignak_logger.load_obj(self._collector) alignak_logger.log_set = True alignak_logger.setLevel(DEBUG) self.generic_tst( lambda x: naglog_result('info', x), 'Some log-message', [1, 1], [r'^\[\d+\] Some log-message\n$', r'^\[\d+\] Some log-message$'])
def test_basic_logging_log(self): sys.stdout = StringIO() self._collector = Collector() sh = StreamHandler(sys.stdout) sh.setFormatter(DEFAULT_FORMATTER) alignak_logger.handlers = [] alignak_logger.addHandler(sh) alignak_logger.load_obj(self._collector) alignak_logger.log_set = True logfile = NamedTemporaryFile("w", delete=False) logfile.close() self.logfile_name = logfile.name alignak_logger.register_local_log(logfile.name, purge_buffer=False) alignak_logger.setLevel(DEBUG) self.generic_tst(lambda x: naglog_result('info', x), 'Some log-message', [1, 1, 1], ['', r'^\[\d+\] Some log-message$', r'^\[\d+\] Some log-message$'])
def test_basic_logging_log(self): sys.stdout = StringIO() self._collector = Collector() sh = StreamHandler(sys.stdout) sh.setFormatter(DEFAULT_FORMATTER) alignak_logger.handlers = [] alignak_logger.addHandler(sh) alignak_logger.load_obj(self._collector) alignak_logger.log_set = True logfile = NamedTemporaryFile("w", delete=False) logfile.close() self.logfile_name = logfile.name alignak_logger.register_local_log(logfile.name, purge_buffer=False) alignak_logger.setLevel(DEBUG) self.generic_tst( lambda x: naglog_result('info', x), 'Some log-message', [1, 1, 1], ['', r'^\[\d+\] Some log-message$', r'^\[\d+\] Some log-message$'])