summaryrefslogtreecommitdiff
path: root/src/leap/bitmask
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2014-05-20 16:11:38 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2014-05-21 15:31:20 -0300
commit4a055fdfd26ff8d3aaaaeeb60924a9ba5fc973f6 (patch)
tree8cb7f622cc10613a3936e7b315fc80d872641261 /src/leap/bitmask
parentbaeb605e53c2e8a7dceee86035f6d4cc6b49e131 (diff)
Replace twisted logs with logging logs.
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r--src/leap/bitmask/backend.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/leap/bitmask/backend.py b/src/leap/bitmask/backend.py
index b138fd8d..96d0b0db 100644
--- a/src/leap/bitmask/backend.py
+++ b/src/leap/bitmask/backend.py
@@ -1262,7 +1262,7 @@ class Backend(object):
"""
Starts the looping call
"""
- log.msg("Starting worker...")
+ logger.debug("Starting worker...")
self._lc.start(0.01)
def stop(self):
@@ -1275,14 +1275,17 @@ class Backend(object):
"""
Delayed stopping of worker. Called from `stop`.
"""
- log.msg("Stopping worker...")
+ logger.debug("Stopping worker...")
if self._lc.running:
self._lc.stop()
else:
logger.warning("Looping call is not running, cannot stop")
+
+ logger.debug("Cancelling ongoing defers...")
while len(self._ongoing_defers) > 0:
d = self._ongoing_defers.pop()
d.cancel()
+ logger.debug("Defers cancelled.")
def _register(self, component):
"""
@@ -1296,8 +1299,7 @@ class Backend(object):
try:
self._components[component.key] = component
except Exception:
- log.msg("There was a problem registering %s" % (component,))
- log.err()
+ logger.error("There was a problem registering %s" % (component,))
def _signal_back(self, _, signal):
"""
@@ -1325,19 +1327,19 @@ class Backend(object):
# A call might not have a callback signal, but if it does,
# we add it to the chain
if cmd[2] is not None:
- d.addCallbacks(self._signal_back, log.err, cmd[2])
- d.addCallbacks(self._done_action, log.err,
+ d.addCallbacks(self._signal_back, logger.error, cmd[2])
+ d.addCallbacks(self._done_action, logger.error,
callbackKeywords={"d": d})
- d.addErrback(log.err)
+ d.addErrback(logger.error)
self._ongoing_defers.append(d)
except Empty:
# If it's just empty we don't have anything to do.
pass
except defer.CancelledError:
logger.debug("defer cancelled somewhere (CancelledError).")
- except Exception:
+ except Exception as e:
# But we log the rest
- log.err()
+ logger.exception("Unexpected exception: {0!r}".format(e))
def _done_action(self, _, d):
"""