From 3c3c52fb6a9a9fe020971d293d565a283de068b8 Mon Sep 17 00:00:00 2001 From: Alexis Le-Quoc Date: Sat, 31 May 2014 13:14:05 -0400 Subject: [PATCH] Fix failing test and reorder logging to always log --- gunicorn/instrument/statsd.py | 2 +- tests/test_009-statsd.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gunicorn/instrument/statsd.py b/gunicorn/instrument/statsd.py index fcd38311..daae4026 100644 --- a/gunicorn/instrument/statsd.py +++ b/gunicorn/instrument/statsd.py @@ -52,6 +52,7 @@ class Statsd(Logger): def info(self, msg, *args, **kwargs): """Log a given statistic if metric, value and type are present """ + Logger.info(self, msg, *args, **kwargs) extra = kwargs.get("extra", None) if extra is not None: metric = extra.get(METRIC_VAR, None) @@ -66,7 +67,6 @@ class Statsd(Logger): self.histogram(metric, value) else: pass - Logger.info(self, msg, *args, **kwargs) # skip the run-of-the-mill logs def debug(self, msg, *args, **kwargs): diff --git a/tests/test_009-statsd.py b/tests/test_009-statsd.py index 24bb6f57..aaf75dd5 100644 --- a/tests/test_009-statsd.py +++ b/tests/test_009-statsd.py @@ -48,7 +48,7 @@ def test_instrument(): t.eq(logger.sock.msgs[0], "gunicorn.log.critical:1|c|@1.0") logger.sock.reset() - logger.access(MockResponse(200), None, {}, timedelta(seconds=7)) + logger.access(MockResponse("200 OK"), None, {}, timedelta(seconds=7)) t.eq(logger.sock.msgs[0], "gunicorn.request.duration:7.0|ms") t.eq(logger.sock.msgs[1], "gunicorn.requests:1|c|@1.0") t.eq(logger.sock.msgs[2], "gunicorn.request.status.200:1|c|@1.0")