Fix failing test and reorder logging to always log

This commit is contained in:
Alexis Le-Quoc 2014-05-31 13:14:05 -04:00
parent 4bf1e1d468
commit 3c3c52fb6a
2 changed files with 2 additions and 2 deletions

View File

@ -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):

View File

@ -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")