summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/core/dispatcher.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/core/dispatcher.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/core/dispatcher.py')
-rw-r--r--src/leap/bitmask/core/dispatcher.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/leap/bitmask/core/dispatcher.py b/src/leap/bitmask/core/dispatcher.py
index fc17b76a..187ebfd5 100644
--- a/src/leap/bitmask/core/dispatcher.py
+++ b/src/leap/bitmask/core/dispatcher.py
@@ -35,7 +35,7 @@ from leap.common.events import catalog
from .api import APICommand, register_method
-logger = Logger()
+log = Logger()
class DispatchError(Exception):
@@ -546,11 +546,9 @@ def _format_error(failure):
expected = getattr(failure.value, 'expected', False)
if not expected:
- try:
- logger.failure('[DISPATCHER] Unexpected error:')
- except:
- logger.debug('[DISPATCHER] Unexpected error: %r' % failure.value)
- logger.warn(failure.getTraceback())
+ log.error('[DISPATCHER] Unexpected error!')
+ log.error('{0!r}'.format(failure.value))
+ log.error(failure.getTraceback())
# if needed, we could add here the exception type as an extra field
return json.dumps({'error': failure.value.message, 'result': None})