log user agents on api call auth.

this'll be useful for trying to figure out which services are using what
This commit is contained in:
Leo Hemsted
2017-12-14 17:12:26 +00:00
parent 32a6f44d3a
commit 9297c6d430
2 changed files with 9 additions and 3 deletions

View File

@@ -93,7 +93,11 @@ def requires_auth():
g.service_id = api_key.service_id
_request_ctx_stack.top.authenticated_service = service
_request_ctx_stack.top.api_user = api_key
current_app.logger.info('Succesful login for service {} with api key {}'.format(service.id, api_key.id))
current_app.logger.info('Succesful login for service {} with api key {}, using client'.format(
service.id,
api_key.id,
request.headers.get('User-Agent')
))
return
else:
# service has API keys, but none matching the one the user provided