コード例 #1
0
    def __init__(self, get_response=None):
        """ Instantiates our Middleware """
        MiddlewareMixin.__init__(self, get_response)

        # Update the default config with user defined config
        self.conf = DEFAULT_CONFIG
        if hasattr(settings, "ACCESS_LOGS_CONFIG"):
            self.conf.update(settings.ACCESS_LOGS_CONFIG)

        # Instantiate our log building facility
        self.log_builder = AccessLogBuilder(self.conf)

        # And register our logger
        self.logger = logging.getLogger("django.advanced_access_logs")

        # Let's precompile our health check regexes
        for entry in self.conf["DEBUG_REQUESTS"]:
            for (k, val) in entry.items():
                entry[k] = re.compile(val)
コード例 #2
0
 def __init__(self, get_response=None):
     MiddlewareMixin.__init__(self)
     self.get_response = get_response