Skip to content

Commit

Permalink
introduce debug flag
Browse files Browse the repository at this point in the history
  • Loading branch information
smn committed Jul 17, 2015
1 parent 76305cf commit 8d5bef4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions consular/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def get_appid(app_id_string):
class Consular(object):

app = Klein()
debug = False

def __init__(self, consul_endpoint, marathon_endpoint):
self.consul_endpoint = consul_endpoint
Expand Down Expand Up @@ -76,7 +77,8 @@ def marathon_request(self, method, path, data=None):
},
data=(json.dumps(data) if data is not None else None),
pool=self.pool)
d.addCallback(self.log_http_response, method, path, data)
if self.debug:
d.addCallback(self.log_http_response, method, path, data)
return d

def consul_request(self, method, path, data=None):
Expand All @@ -88,7 +90,8 @@ def consul_request(self, method, path, data=None):
},
data=(json.dumps(data) if data is not None else None),
pool=self.pool)
d.addCallback(self.log_http_response, method, path, data)
if self.debug:
d.addCallback(self.log_http_response, method, path, data)
return d

@app.route('/')
Expand Down

0 comments on commit 8d5bef4

Please sign in to comment.