Пример #1
0
def log_request_exception(sender, **kwargs):
    """log the exception with traceback."""

    _ = sender
    exception = traceback.format_exc()
    request = kwargs["request"]
    log_mgr.write_log_entry(request=request, response_status_code=500, exception=exception)
Пример #2
0
def mark_alerts_displayed(request, alerts):
    """
    Simple tag to mark the alerts displayed.
    """
    for alert in alerts:
        log_mgr.write_log_entry(request, 200, "/slog/notifications/alert/%d/" % alert.pk)
        alert.display_alert = False
        alert.save()

    return ""
Пример #3
0
    def process_response(self, request, response):
        """Log the actions of logged in users."""

        #time_start = datetime.datetime.now()

        # Filter out the following paths.  Logs will not be created for these
        # paths.
        if re.match(MEDIA_REGEXP, request.path) or \
           request.path in URL_FILTER:
            return response

        log_mgr.write_log_entry(request=request, response_status_code=response.status_code)

        #time_end = datetime.datetime.now()
        #print "%s time: %s" % ("logging", (time_end - time_start))
        #print "%s timestamp: %s" % ("End logging middleware", time_end)
        return response
Пример #4
0
    def process_response(self, request, response):
        """Log the actions of logged in users."""

        #time_start = datetime.datetime.now()

        # Filter out the following paths.  Logs will not be created for these
        # paths.
        if re.match(MEDIA_REGEXP, request.path) or \
           request.path in URL_FILTER:
            return response

        log_mgr.write_log_entry(request=request, response_status_code=response.status_code)

        #time_end = datetime.datetime.now()
        #print "%s time: %s" % ("logging", (time_end - time_start))
        #print "%s timestamp: %s" % ("End logging middleware", time_end)
        return response