Move the prefix assignment out of the try block for socket creation

This commit is contained in:
Scott Sanders 2014-09-14 13:42:18 -04:00
parent 51bd154c99
commit cb92b5bba7

View File

@ -25,9 +25,9 @@ class Statsd(Logger):
"""host, port: statsD server
"""
Logger.__init__(self, cfg)
self.prefix = cfg.statsd_prefix
try:
host, port = cfg.statsd_host
self.prefix = cfg.statsd_prefix
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.sock.connect((host, int(port)))
except Exception: