Skip to content
This repository has been archived by the owner on Dec 16, 2019. It is now read-only.

Commit

Permalink
Changed some logging levels and config
Browse files Browse the repository at this point in the history
  • Loading branch information
viklund committed Sep 13, 2018
1 parent 727d174 commit 263eba2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
14 changes: 11 additions & 3 deletions lega/conf/loggers/console.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions lega/keyserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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())
Expand All @@ -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()
Expand Down Expand Up @@ -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'''
Expand Down

0 comments on commit 263eba2

Please sign in to comment.