def test_basic_logging_log(self): sys.stdout = StringIO() self._collector = Collector() sh = StreamHandler(sys.stdout) sh.setFormatter(defaultFormatter) shinken_logger.handlers = [] shinken_logger.addHandler(sh) shinken_logger.load_obj(self._collector) shinken_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(defaultFormatter) shinken_logger.handlers = [] shinken_logger.addHandler(sh) shinken_logger.load_obj(self._collector) shinken_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(defaultFormatter) shinken_logger.handlers = [] shinken_logger.addHandler(sh) shinken_logger.load_obj(self._collector) logfile = NamedTemporaryFile("w", delete=False) logfile.close() self.logfile_name = logfile.name shinken_logger.register_local_log(logfile.name) shinken_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(defaultFormatter) shinken_logger.handlers = [] shinken_logger.addHandler(sh) shinken_logger.load_obj(self._collector) logfile = NamedTemporaryFile("w", delete=False) logfile.close() self.logfile_name = logfile.name shinken_logger.register_local_log(logfile.name) shinken_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$'])