1
0
mirror of https://gitlab.com/brutaldon/brutaldon.git synced 2024-12-04 14:46:24 -05:00

Add extra debug logging to production

This commit is contained in:
Jason McBrayer 2018-06-05 08:18:06 -04:00
parent e63d6b86f5
commit e05601db22
2 changed files with 52 additions and 4 deletions

View File

@ -103,6 +103,58 @@ AUTH_PASSWORD_VALIDATORS = [
},
]
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse',
},
'require_debug_true': {
'()': 'django.utils.log.RequireDebugTrue',
},
},
'formatters': {
'django.server': {
'()': 'django.utils.log.ServerFormatter',
'format': '[%(server_time)s] %(message)s',
}
},
'handlers': {
'console': {
'level': 'INFO',
'filters': ['require_debug_true'],
'class': 'logging.StreamHandler',
},
'console_debug_false': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'logging.StreamHandler',
},
'django.server': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'formatter': 'django.server',
},
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django': {
'handlers': ['console', 'console_debug_false', 'mail_admins'],
'level': 'INFO',
},
'django.server': {
'handlers': ['django.server'],
'level': 'INFO',
'propagate': False,
}
}
}
# Internationalization
# https://docs.djangoproject.com/en/2.0/topics/i18n/

View File

@ -35,7 +35,6 @@ def get_mastodon(request):
raise NotLoggedInException()
if request.session['access_token'] in pool.keys():
mastodon = pool[request.session['access_token']]
print("Mastodon from pool")
else:
mastodon = Mastodon(
client_id = client.client_id,
@ -43,7 +42,6 @@ def get_mastodon(request):
api_base_url = client.api_base_id,
access_token = request.session['access_token'],
ratelimit_method='throw')
print("New Mastodon added to pool")
pool[request.session['access_token']] = mastodon
else:
try:
@ -54,7 +52,6 @@ def get_mastodon(request):
raise NotLoggedInException()
if user.access_token in pool.keys():
mastodon = pool[user.access_token]
print("Mastodon from pool")
else:
mastodon = Mastodon(
client_id = client.client_id,
@ -63,7 +60,6 @@ def get_mastodon(request):
api_base_url = client.api_base_id,
ratelimit_method="throw")
print("New Mastodon added to pool")
pool[user.access_token] = mastodon
return mastodon
def fullbrutalism_p(request):