diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2017-04-25 18:00:12 +0200 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2017-04-27 19:33:28 +0200 |
commit | 9f95446a55533c8cdceec7c4430be5cad752ecb1 (patch) | |
tree | 4265c127ee9b2c5f1e038836ad2e7b92ea0cad80 /src/leap/bitmask/core/service.py | |
parent | 9a1548aa01996ce93febe0272f1f8e4dd5e130ff (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/service.py')
-rw-r--r-- | src/leap/bitmask/core/service.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/leap/bitmask/core/service.py b/src/leap/bitmask/core/service.py index c06a534..2972a51 100644 --- a/src/leap/bitmask/core/service.py +++ b/src/leap/bitmask/core/service.py @@ -37,9 +37,6 @@ from leap.bitmask.core.web.service import HTTPDispatcherService from leap.bitmask.vpn.service import VPNService from leap.common.events import server as event_server -logger = Logger() - - backend = flags.BACKEND if backend == 'default': @@ -52,6 +49,9 @@ else: raise RuntimeError('Backend not supported') +log = Logger() + + class BitmaskBackend(configurable.ConfigurableService): """ @@ -68,7 +68,8 @@ class BitmaskBackend(configurable.ConfigurableService): # The global token is used for authenticating some of the channels that # expose the dispatcher. For the moment being, this is the REST API. self.global_tokens = [uuid.uuid4().hex] - logger.info('Global token: {0}'.format(self.global_tokens[0])) + log.debug( + 'Global token: {0}'.format(self.global_tokens[0])) self._touch_token_file() # These tokens are user-session tokens. Implemented and rolled back, @@ -129,13 +130,13 @@ class BitmaskBackend(configurable.ConfigurableService): sessions.setServiceParent(self) def _start_child_service(self, name): - logger.debug('starting backend child service: %s' % name) + log.debug('Starting backend child service: %s' % name) service = self.getServiceNamed(name) if service: service.startService() def _stop_child_service(self, name): - logger.debug('stopping backend child service: %s' % name) + log.debug('Stopping backend child service: %s' % name) service = self.getServiceNamed(name) if service: service.stopService() @@ -203,7 +204,6 @@ class BitmaskBackend(configurable.ConfigurableService): try: service = self.getServiceNamed(label) except KeyError: - logger.debug("initializing service: %s" % label) service = klass(*args, **kw) service.setName(label) service.setServiceParent(self) @@ -282,8 +282,6 @@ class BackendCommands(object): return {'version_core': __version__} def do_stats(self): - print "DO STATS" - logger.debug('BitmaskCore Service STATS') mem = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss return {'mem_usage': '%s MB' % (mem / 1024)} |