def _prepare_logging(self): self._collector = Collector() self._stdout = sys.stdout sys.stdout = StringIO() logger = Log(name=None) sh = StreamHandler(sys.stdout) sh.setFormatter(defaultFormatter) logger.addHandler(sh) logger.load_obj(self._collector) return logger
def _prepare_logging(self): self._collector = Collector() self._stdout = sys.stdout sys.stdout = StringIO() logger = Log(name=None, log_set=True) from shinken.log import defaultFormatter from logging import StreamHandler sh = StreamHandler(sys.stdout) sh.setFormatter(defaultFormatter) logger.addHandler(sh) logger.load_obj(self._collector, 'Tiroler Schinken') return logger
def _prepare_logging(self): self._collector = Collector() self._stdout = sys.stdout sys.stdout = StringIO() logger = Log(name=None, log_set=True) sh = StreamHandler(sys.stdout) sh.setFormatter(defaultFormatter) logger.addHandler(sh) logger.load_obj(self._collector) logger.pre_log_buffer = [] # reset the pre_log for several tests return logger
def test_load_obj_must_not_change_level(self): logger = Log(name=None, log_set=True) # argl, load_obj() unsets the level! save and restore it logger.setLevel(logging.CRITICAL) logger.load_obj(Dummy()) self.assertEqual(logger.level, min(CRITICAL, INFO))