SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 883909b1 authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Add logging for api

parent 02050f76
No related branches found
No related tags found
No related merge requests found
......@@ -421,6 +421,12 @@ LOGGING = {
'filename': '/path/to/logs/doi.log',
'formatter': 'verbose',
},
'api_file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': '/path/to/logs/api.log',
'formatter': 'verbose',
},
'oauth_file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
......@@ -447,6 +453,12 @@ LOGGING = {
'propagate': False,
'formatter': 'verbose'
},
'api': {
'handlers': ['api_file'],
'level': 'DEBUG',
'propagate': False,
'formatter': 'verbose'
},
'oauth2_provider': {
'handlers': ['oauth_file'],
'level': 'DEBUG',
......
......@@ -20,6 +20,7 @@ MAILCHIMP_API_KEY = get_secret("MAILCHIMP_API_KEY")
# Logging
LOGGING['handlers']['scipost_file_arxiv']['filename'] = '/Users/jscaux/Sites/SciPost.org/scipost_v1/local_files/logs/arxiv.log'
LOGGING['handlers']['scipost_file_doi']['filename'] = '/Users/jscaux/Sites/SciPost.org/scipost_v1/local_files/logs/doi.log'
LOGGING['handlers']['api_file']['filename'] = '/Users/jscaux/Sites/SciPost.org/scipost_v1/local_files/logs/api.log'
LOGGING['handlers']['oauth_file']['filename'] = '/Users/jscaux/Sites/SciPost.org/scipost_v1/local_files/logs/oauth.log'
CROSSREF_DEPOSIT_EMAIL = 'jscaux@scipost.org'
......
......@@ -59,6 +59,7 @@ ITHENTICATE_PASSWORD = get_secret('ITHENTICATE_PASSWORD')
# Logging
LOGGING['handlers']['scipost_file_arxiv']['filename'] = '/home/scipost/webapps/scipost_py38/logs/arxiv.log'
LOGGING['handlers']['scipost_file_doi']['filename'] = '/home/scipost/webapps/scipost_py38/logs/doi.log'
LOGGING['handlers']['api_file']['filename'] = '/home/scipost/webapps/scipost_py38/logs/api.log'
LOGGING['handlers']['oauth_file']['filename'] = '/home/scipost/webapps/scipost_py38/logs/oauth.log'
......
......@@ -3,11 +3,14 @@ __license__ = "AGPL v3"
import json
import logging
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from oauth2_provider.decorators import protected_resource
log = logging.getLogger(__name__)
@csrf_exempt
@protected_resource()
......@@ -15,6 +18,11 @@ def userinfo(request):
"""
Return basic user info, required for using SciPost as OAuth2 authorization server
"""
log.debug(request.headers)
log.debug(request.META)
log.debug(request.GET)
log.debug(request.user)
log.debug(request.user.is_authenticated)
user = request.user
return HttpResponse(
json.dumps({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment