Skip to content

Commit

Permalink
Hot fix: remove kv in logger (#433)
Browse files Browse the repository at this point in the history
kv is not a implementation in python logging package
  • Loading branch information
meng-han committed Aug 21, 2024
1 parent 6328f13 commit ef1d611
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions confidant/routes/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,26 +266,21 @@ def get_service(id):
return jsonify(error_msg), 403

logger.info(
'get_service called', kv={
'id': id,
'user': logged_in_user,
'metadata_only': metadata_only
}
f'get_service called on id={id} by '
f'user={logged_in_user} metadata_only={metadata_only}'
)

with stats.timer('get_service_by_id.db_get_service'):
try:
service = Service.get(id)
if not authnz.service_in_account(service.account):
logger.warning(
'Authz failed for service (wrong account).',
kv={'id': id}
f'Authz failed for service {id} (wrong account).'
)
msg = 'Authenticated user is not authorized.'
return jsonify({'error': msg}), 401
except DoesNotExist:
logger.warning('Item with id does not exist.',
kv={'id': id})
logger.warning(f'Item with id={id} does not exist.')
return jsonify({}), 404
except Exception as e:
logger.warning('Exception occurred: {0}'.format(e))
Expand Down

0 comments on commit ef1d611

Please sign in to comment.