From 4169660ae5014be82ba16343aaad689418bd29a7 Mon Sep 17 00:00:00 2001 From: Difrex Date: Wed, 5 Oct 2016 14:16:51 +0300 Subject: [PATCH] log format --- surok/discovery.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/surok/discovery.py b/surok/discovery.py index 5b8322a..e3d7cb1 100644 --- a/surok/discovery.py +++ b/surok/discovery.py @@ -4,6 +4,11 @@ from dns.exception import DNSException import logging +# Configure logging +FORMAT = '%(asctime) %(message)s' +logging.basicConfig(format=FORMAT) +logger = logging.getLogger('discovery') + # Resolve service from mesos-dns SRV record # return dict {"servicename": [{"name": "service.f.q.d.n.", "port": 9999}]} def resolve(app, conf): @@ -84,7 +89,7 @@ def do_query(fqdn, loglevel): servers.append(server) except DNSException as e: if loglevel != 'info': - logging.error("Could not resolve " + fqdn + ': ' + str(e)) + logger.error("Could not resolve " + fqdn + ': ' + str(e)) return {"state": 404} return servers