<commit_before>import logging
log = logging.getLogger(__name__)

from pyramid.view import (
            view_config,
            notfound_view_config,
        )

from sqlalchemy.exc import DBAPIError

@view_config(context=DBAPIError, renderer='db_failed.mako')
def db_failed(context, request):
    log.exception(context)
    request.response.status_int = 503
    return {}

# Add a slash if the view has not been found.
@notfound_view_config(renderer='not_found.mako', append_slash=True)
def not_found(request):
    request.response.status_int = 404
    return {}<commit_msg>Log 404 not found errors when in debug mode<commit_after>import logging
log = logging.getLogger(__name__)

from pyramid.view import (
            view_config,
            notfound_view_config,
        )

from sqlalchemy.exc import DBAPIError

@view_config(context=DBAPIError, renderer='db_failed.mako')
def db_failed(context, request):
    log.exception(context)
    request.response.status_int = 503
    return {}

# Add a slash if the view has not been found.
@notfound_view_config(renderer='not_found.mako', append_slash=True)
def not_found(context, request):
    if request.registry.settings.get('pyramid.debug_notfound', False):
        log.exception(context)
    request.response.status_int = 404
    return {}
{'fraction_non_alphanumeric': 0.09295120061967467, 'fraction_numerical': 0.011618900077459334, 'mean_word_length': 4.027237354085603, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '753596', 'n_tokens_mistral': 414, 'n_tokens_neox': 392, 'n_words': 91}