Simplify and explain our overrides

This should also fix the 500s-in-prod issue, yay
This commit is contained in:
Joel Bradshaw 2022-01-09 23:26:27 -08:00
parent 83851c2933
commit 085dd24a62

View file

@ -106,27 +106,30 @@ TEMPLATES = [
},
]
LOG_LEVEL = env('LOG_LEVEL', 'INFO').upper()
# Override aspects of the default handler to our taste
# See https://docs.djangoproject.com/en/3.2/topics/logging/#default-logging-configuration
# for a reference to the defaults we're overriding
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
# Overrides the default handler, which does not log in prod
'console': {
'level': LOG_LEVEL,
'class': 'logging.StreamHandler',
},
},
'root': {
'handlers': ['console'],
'level': 'WARNING',
},
'loggers': {
# Override the log level for the default logger
'django': {
'handlers': ['console'],
'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
'propagate': False,
'handlers': ['console', 'mail_admins'],
'level': LOG_LEVEL,
},
# Add a bookwyrm-specific logger
'bookwyrm': {
'handlers': ['console'],
'level': os.getenv('LOG_LEVEL', 'DEBUG' if DEBUG else 'INFO').upper(),
'level': LOG_LEVEL,
}
},
}