From 263eba2c4b8096645172a8c2ca709c203536d6a2 Mon Sep 17 00:00:00 2001 From: Johan Viklund Date: Thu, 13 Sep 2018 09:43:03 +0200 Subject: [PATCH] Changed some logging levels and config --- lega/conf/loggers/console.yaml | 14 +++++++++++--- lega/keyserver.py | 12 ++++++------ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/lega/conf/loggers/console.yaml b/lega/conf/loggers/console.yaml index 089c7984..2a3aa654 100644 --- a/lega/conf/loggers/console.yaml +++ b/lega/conf/loggers/console.yaml @@ -5,15 +5,23 @@ root: loggers: lega: - level: INFO + level: DEBUG handlers: [console] propagate: true qualname: lega + lega.utils.eureka: + level: INFO + handlers: [console] + propagate: false + lega.keyserver: + level: INFO + handlers: [console] + propagate: false asyncio: - level: ERROR + level: WARN handlers: [console] aiohttp: - level: ERROR + level: WARN handlers: [console] propagate: true qualname: aiohttp diff --git a/lega/keyserver.py b/lega/keyserver.py index 3fa9b18c..3a46b5c4 100644 --- a/lega/keyserver.py +++ b/lega/keyserver.py @@ -110,7 +110,7 @@ def _unlock_key(name, active=None, path=None, expire=None, passphrase=None, **kw assert not key.is_public, f"The key {name} should be private" with key.unlock(passphrase) as k: key_id = k.fingerprint.keyid.upper() - LOG.debug(f'Activating key: {key_id} ({name})') + LOG.info(f'Activating key: {key_id} ({name})') _cache.set(key_id, k, ttl=expire) if active and name == active: global _active @@ -124,7 +124,7 @@ def _unlock_key(name, active=None, path=None, expire=None, passphrase=None, **kw @routes.get('/active/{key_type}') async def retrieve_active_key(request): key_type = request.match_info['key_type'].lower() - LOG.debug(f'Requesting active ({key_type}) key') + LOG.info(f'Requesting active ({key_type}) key') if key_type not in ('public', 'private'): return web.HTTPForbidden() # web.HTTPBadRequest() key_format = 'armored' if request.content_type == 'text/plain' else None @@ -139,14 +139,14 @@ async def retrieve_active_key(request): @routes.get('/retrieve/{requested_id}/{key_type}') async def retrieve_key(request): - LOG.debug('Retrieve key') + LOG.info('Retrieve key') requested_id = request.match_info['requested_id'] key_type = request.match_info['key_type'].lower() if key_type not in ('public', 'private'): return web.HTTPForbidden() # web.HTTPBadRequest() key_id = requested_id[-16:].upper() key_format = 'armored' if request.content_type == 'text/plain' else None - LOG.debug(f'Requested {key_type.upper()} key with ID {requested_id}') + LOG.info(f'Requested {key_type.upper()} key with ID {requested_id}') k = _cache.get(key_id, key_type, key_format=key_format) if k: return web.Response(body=k) # web.Response(text=value.hex()) @@ -161,7 +161,7 @@ async def unlock_key(request): \{"private": "path/to/file.sec", "passphrase": "pass", "expire": "30/MAR/18 08:00:00"\} """ key_info = await request.json() - LOG.debug(f'Admin unlocking: {key_info}') + LOG.info(f'Admin unlocking: {key_info}') if all(k in key_info for k in("path", "passphrase", "expire")): _unlock_key('whichname?', **key_info) return web.HTTPAccepted() @@ -205,7 +205,7 @@ async def renew_lease(eureka, interval): while alive: await asyncio.sleep(interval) await eureka.renew() - LOG.info('Keyserver Eureka lease renewed.') + LOG.debug('Keyserver Eureka lease renewed.') async def init(app): '''Initialization running before the loop.run_forever'''