From 380ed56c213ae7a2aa192904c7c031626fad57c2 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 2 Apr 2017 01:56:57 +0100 Subject: [PATCH 1/1] wip debug --- client | 5 +++-- hippotat/__init__.py | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/client b/client index a5edd7e..19efb03 100755 --- a/client +++ b/client @@ -81,7 +81,7 @@ class ResponseConsumer(GeneralResponseConsumer): self._log(DBG.HTTP_CTRL, '__init__') def dataReceived(self, data): - self._log(DBG.HTTP_CTRL, 'dataReceived', d=data) + self._log(DBG.HTTP, 'dataReceived', d=data) try: self._ssd.inputdata(data) except Exception as e: @@ -93,6 +93,7 @@ class ResponseConsumer(GeneralResponseConsumer): self.latefailure() return try: + self._log(DBG.HTTP, 'ResponseDone') self._ssd.flush() req_fin(self._req) except Exception as e: @@ -102,7 +103,7 @@ class ResponseConsumer(GeneralResponseConsumer): self._latefailure(traceback.format_exc()) def _latefailure(self, reason): - self._log(DBG.HTTP_CTRL, '_asyncFailure ' + str(reason)) + self._log(DBG.HTTP_CTRL, '_latefailure ' + str(reason)) req_err(self._req, reason) class ErrorResponseConsumer(twisted.internet.protocol.Protocol): diff --git a/hippotat/__init__.py b/hippotat/__init__.py index fa43065..e13b31f 100644 --- a/hippotat/__init__.py +++ b/hippotat/__init__.py @@ -32,23 +32,25 @@ import re as regexp import hippotat.slip as slip class DBG(twisted.python.constants.Names): + INIT = NamedConstant() ROUTE = NamedConstant() DROP = NamedConstant() FLOW = NamedConstant() HTTP = NamedConstant() - HTTP_CTRL = NamedConstant() - INIT = NamedConstant() + TWISTED = NamedConstant() QUEUE = NamedConstant() + HTTP_CTRL = NamedConstant() QUEUE_CTRL = NamedConstant() HTTP_FULL = NamedConstant() - SLIP_FULL = NamedConstant() CTRL_DUMP = NamedConstant() + SLIP_FULL = NamedConstant() _hex_codec = codecs.getencoder('hex_codec') log = twisted.logger.Logger() def log_debug(dflag, msg, idof=None, d=None): + if dflag > DBG.HTTP: return #print('---------------->',repr((dflag, msg, idof, d)), file=sys.stderr) if idof is not None: msg = '[%#x] %s' % (id(idof), msg) -- 2.30.2