관리-도구
편집 파일: web_log.cpython-37.pyc
B �k�a� � @ s� d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlmZm Z m Z mZmZm Z ddlmZ ddlmZ ddlmZ edd �ZG d d� de�ZdS )� N)� namedtuple)�Any�Callable�Dict�Iterable�List�Tuple� )�AbstractAccessLogger)�BaseRequest)�StreamResponse� KeyMethodz key methodc s� e Zd ZdZdddddddd d ddd �ZdZe�d�Ze�d�Z i Z efeje dd�� fdd� Ze ee ee f d�dd�Zee eeee d�dd��Zee eeee d�dd��Zeeeee d�dd��Zeeeee d�d d!��Zeeeee d�d"d#��Zeeeee d�d$d%��Zeeeeed�d&d'��Zeeeeed�d(d)��Zeeeee d�d*d+��Z eeeee d�d,d-��Z!eeeee d�d.d/��Z"eeee#ee e$eeege f f d�d0d1�Z%eeedd�d2d3�Z&� Z'S )4�AccessLoggera� Helper object to log access. Usage: log = logging.getLogger("spam") log_format = "%a %{User-Agent}i" access_logger = AccessLogger(log, log_format) access_logger.log(request, response, time) Format: %% The percent sign %a Remote IP-address (IP-address of proxy if using reverse proxy) %t Time when the request was started to process %P The process ID of the child that serviced the request %r First line of request %s Response status code %b Size of response in bytes, including HTTP headers %T Time taken to serve the request, in seconds %Tf Time taken to serve the request, in seconds with floating fraction in .06f format %D Time taken to serve the request, in microseconds %{FOO}i request.headers['FOO'] %{FOO}o response.headers['FOO'] %{FOO}e os.environ['FOO'] Zremote_addressZrequest_start_timeZ process_idZfirst_request_lineZresponse_statusZ response_sizeZrequest_timeZrequest_time_fracZrequest_time_microZrequest_headerZresponse_header)�a�t�P�r�s�b�TZTf�D�i�oz/%a %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"z.%(\{([A-Za-z0-9\-_]+)\}([ioe])|[atPrsbOD]|Tf?)z(%[^s])N)�logger� log_format�returnc sD t � j||d� tj�|�}|s4| �|�}|tj|<