Fix logger

This commit is contained in:
Joseph Schorr 2014-01-24 15:09:35 -05:00
parent 77f2706a19
commit efcbe4421d

View file

@ -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))