summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/hooks.py
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2017-04-25 18:00:12 +0200
committerKali Kaneko (leap communications) <kali@leap.se>2017-04-27 19:33:28 +0200
commit9f95446a55533c8cdceec7c4430be5cad752ecb1 (patch)
tree4265c127ee9b2c5f1e038836ad2e7b92ea0cad80 /src/leap/bitmask/hooks.py
parent9a1548aa01996ce93febe0272f1f8e4dd5e130ff (diff)
[bug] unify logging style using class attr
I changed most of the logger statements to use a class attribute, in this way it's easier to identify which class it's logging them. in some cases I leave a module-level logger, when we're either using functions or when the module it's too small. at the same time I did a general review and cleanup of the logging statements.
Diffstat (limited to 'src/leap/bitmask/hooks.py')
-rw-r--r--src/leap/bitmask/hooks.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/leap/bitmask/hooks.py b/src/leap/bitmask/hooks.py
index fb9771e9..3e9324e0 100644
--- a/src/leap/bitmask/hooks.py
+++ b/src/leap/bitmask/hooks.py
@@ -25,7 +25,7 @@ from twisted.logger import Logger
from zope.interface import implementer
-logger = Logger()
+log = Logger()
@implementer(IService)
@@ -47,7 +47,7 @@ class HookableService(Service):
def register_hook(self, name, listener):
if not hasattr(self, 'event_listeners'):
self.event_listeners = defaultdict(list)
- logger.debug('registering hook %s->%s' % (name, listener))
+ log.debug('registering hook %s->%s' % (name, listener))
self.event_listeners[name].append(listener)
def trigger_hook(self, name, **data):
@@ -55,8 +55,8 @@ class HookableService(Service):
def react_to_hook(listener, name, **kw):
try:
getattr(listener, 'hook_' + name)(**kw)
- except AttributeError as exc:
- logger.failure('Error while triggering hook')
+ except AttributeError:
+ log.failure('Error while triggering hook')
raise RuntimeError(
"Tried to notify a hook, but the listener "
"service class %s does not seem to have "