def request_finished_callback(sender, **kwargs):
    """This function logs if the user acceses the page"""
    logger = logging.getLogger(__name__)
    level = settings.AUTOMATED_LOGGING['loglevel']['request']

    user = get_current_user()
    uri, application, method, status = get_current_environ()

    excludes = settings.AUTOMATED_LOGGING['exclude']['request']
    if status and status in excludes:
        return

    if method and method.lower() in excludes:
        return

    if not settings.AUTOMATED_LOGGING['request']['query']:
        uri = urllib.parse.urlparse(uri).path

    logger.log(level, ('%s performed request at %s (%s %s)' %
                       (user, uri, method, status)).replace("  ", " "), extra={
        'action': 'request',
        'data': {
            'user': user,
            'uri': uri,
            'method': method,
            'application': application,
            'status': status
        }
    })
def request_finished_callback ( sender , ** kwargs ) : logger = logging . getLogger ( __name__ ) level = settings . AUTOMATED_LOGGING [ 'loglevel' ] [ 'request' ] user = get_current_user ( ) uri , application , method , status = get_current_environ ( ) excludes = settings . AUTOMATED_LOGGING [ 'exclude' ] [ 'request' ] if status and status in excludes : return if method and method . lower ( ) in excludes : return if not settings . AUTOMATED_LOGGING [ 'request' ] [ 'query' ] : uri = urllib . parse . urlparse ( uri ) . path logger . log ( level , ( '%s performed request at %s (%s %s)' % ( user , uri , method , status ) ) . replace ( "  " , " " ) , extra = { 'action' : 'request' , 'data' : { 'user' : user , 'uri' : uri , 'method' : method , 'application' : application , 'status' : status } } )
This function logs if the user acceses the page