Fix logger
This commit is contained in:
parent
77f2706a19
commit
efcbe4421d
1 changed files with 5 additions and 1 deletions
|
@ -1,6 +1,10 @@
|
|||
import logging
|
||||
|
||||
from flask import request, abort as flask_abort
|
||||
from auth.auth import process_auth, extract_namespace_repo_from_session, get_authenticated_user, get_validated_token
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
DEFAULT_MESSAGE = {}
|
||||
DEFAULT_MESSAGE[400] = 'Invalid Request'
|
||||
DEFAULT_MESSAGE[403] = 'Forbidden'
|
||||
|
@ -20,7 +24,7 @@ def abort(status_code, message=None, **kwargs):
|
|||
message = message % kwargs if message else DEFAULT_MESSAGE[status_code]
|
||||
|
||||
# Log the abort.
|
||||
log.error('Error %s: %s. Arguments: %s' % (status_code, message, request.view_args))
|
||||
logger.error('Error %s: %s. Arguments: %s' % (status_code, message, request.view_args))
|
||||
|
||||
# Report the abort to the user.
|
||||
flask_abort(make_response(HTTPException(message), status_code, headers))
|
||||
|
|
Reference in a new issue