def test_logger(self):
     logger = TestLogger()
     processor = LoggingMessageProcessor(logger)
     metric = FakeMeterMetric()
     processor.meter_metrics['test'] = metric
     list(processor.flush())
     expected = ["Out: %s %s %s" % message for message in metric.report()]
     self.assertFalse(set(expected).difference(logger.log.splitlines()))
Exemplo n.º 2
0
 def test_logger(self):
     logger = TestLogger()
     processor = LoggingMessageProcessor(logger)
     metric = FakeMeterMetric()
     processor.meter_metrics['test'] = metric
     processor.flush()
     expected = ["Out: %s %s %s" % message
                 for message in metric.report()]
     self.assertFalse(set(expected).difference(logger.log.splitlines()))
Exemplo n.º 3
0
 def test_logger_plugin(self):
     logger = TestLogger()
     processor = LoggingMessageProcessor(
         logger, plugins=[distinct_metric_factory],
         time_function=lambda: 42)
     msg_in = "gorets:17|pd"
     processor.process(msg_in)
     list(processor.flush())
     messages = processor.plugin_metrics['gorets'].flush(
         10, processor.time_function())
     expected = ["In: %s" % msg_in] + ["Out: %s %s %s" % message
                                       for message in messages]
     self.assertFalse(set(expected).difference(logger.log.splitlines()))
        def invoker():
            class Logger(object):
                def __init__(self):
                    self.info = 'logger'

            logger = Logger()
            LoggingMessageProcessor(logger)
 def test_logger_plugin(self):
     logger = TestLogger()
     processor = LoggingMessageProcessor(logger,
                                         plugins=[distinct_metric_factory],
                                         time_function=lambda: 42)
     msg_in = "gorets:17|pd"
     processor.process(msg_in)
     list(processor.flush())
     messages = processor.plugin_metrics['gorets'].flush(
         10, processor.time_function())
     expected = ["In: %s" % msg_in
                 ] + ["Out: %s %s %s" % message for message in messages]
     self.assertFalse(set(expected).difference(logger.log.splitlines()))
 def invoker():
     logger = 'logger'
     LoggingMessageProcessor(logger)