§
    ~Štj'!  ã                   ó²   — d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZ d dl	m
Z
mZmZ ddlmZ ddlmZ ddlmZ  G d„ d	e¦  «        Z G d
„ de¦  «        ZdS )é    N)ÚIterable)ÚCallableÚClassVarÚ
NamedTupleé   )ÚAbstractAccessLogger)ÚBaseRequest)ÚStreamResponsec                   óP   — e Zd ZU eeeef         z  ed<   eeee	gef         ed<   dS )Ú	KeyMethodÚkeyÚmethodN)
Ú__name__Ú
__module__Ú__qualname__ÚstrÚtupleÚ__annotations__r   r	   r
   Úfloat© ó    úM/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/aiohttp/web_log.pyr   r      sH   € € € € € € Ø	ˆu�S˜#�XŒÑ	ÐÐÑØ�k >°5Ð9¸3Ð>Ô?Ð?Ð?Ñ?Ð?Ð?r   r   c                   ó®  ‡ — e Zd ZU dZdddddddd	d
dddœZdZ ej        d¦  «        Z ej        d¦  «        Z	i Z
eeeeee         f         f         ed<   dZeej        dz           ed<   dZee         ed<   efdej        deddfˆ fd„Zdedeeee         f         fd„Zedededededef
d„¦   «         Zedededededef
d „¦   «         Zededededefd!„¦   «         Z e!dej        fd"„¦   «         Z"ededededefd#„¦   «         Z#ededededefd$„¦   «         Z$ededededefd%„¦   «         Z%edededede&fd&„¦   «         Z'edededede&fd'„¦   «         Z(ededededefd(„¦   «         Z)ededededefd)„¦   «         Z*ededededefd*„¦   «         Z+dededede,eeeeef         z  ef                  fd+„Z-e.de/fd,„¦   «         Z0dedededdfd-„Z1ˆ xZ2S ).Ú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']

    Úremote_addressÚrequest_start_timeÚ
process_idÚfirst_request_lineÚresponse_statusÚresponse_sizeÚrequest_timeÚrequest_time_fracÚrequest_time_microÚrequest_headerÚresponse_header)ÚaÚtÚPÚrÚsÚbÚTÚTfÚDÚiÚoz/%a %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"z.%(\{([A-Za-z0-9\-_]+)\}([ioe])|[atPrsbOD]|Tf?)z(%[^s])Ú_FORMAT_CACHENÚ
_cached_tzg        Ú_cached_tz_expiresÚloggerÚ
log_formatÚreturnc                 óö   •— t          ¦   «                              ||¬¦  «         t          j                             |¦  «        }|s$|                      |¦  «        }|t          j        |<   |\  | _        | _        dS )z©Initialise the logger.

        logger is a logger object to be used for logging.
        log_format is a string with apache compatible log format description.

        )r5   N)ÚsuperÚ__init__r   r1   ÚgetÚcompile_formatÚ_log_formatÚ_methods)Úselfr4   r5   Ú_compiled_formatÚ	__class__s       €r   r9   zAccessLogger.__init__E   sv   ø€ õ 	‰Œ×Ò˜¨JÐÑ7Ô7Ð7å'Ô5×9Ò9¸*ÑEÔEÐØð 	FØ#×2Ò2°:Ñ>Ô>ÐØ5E�LÔ& zÑ2à*:Ñ'ˆÔ˜$œ-˜-˜-r   c           	      óV  — t          ¦   «         }| j                             |¦  «        D ]Ç}|d         dk    rB| j        |d                  }t	          t
          d|d         z  ¦  «        }t          ||¦  «        }nb| j        |d                  |d         f}t	          t
          d|d         z  ¦  «        }t          |t          j        ||d         ¦  «        ¦  «        }| 	                    |¦  «         ŒÈ| j         
                    d|¦  «        }| j         
                    d|¦  «        }||fS )aÜ  Translate log_format into form usable by modulo formatting

        All known atoms will be replaced with %s
        Also methods for formatting of those atoms will be added to
        _methods in appropriate order

        For example we have log_format = "%a %t"
        This format will be translated to "%s %s"
        Also contents of _methods will be
        [self._format_a, self._format_t]
        These method will be called and results will be passed
        to translated string format.

        Each _format_* method receive 'args' which is list of arguments
        given to self.log

        Exceptions are _format_e, _format_i and _format_o methods which
        also receive key name (by functools.partial)

        r   Ú r   z
_format_%sé   z%sz%\1)ÚlistÚ	FORMAT_REÚfindallÚLOG_FORMAT_MAPÚgetattrr   r   Ú	functoolsÚpartialÚappendÚsubÚ
CLEANUP_RE)r>   r5   ÚmethodsÚatomÚformat_key1ÚmÚ
key_methodÚformat_key2s           r   r;   zAccessLogger.compile_formatU   s  € õ. ‘&”&ˆà”N×*Ò*¨:Ñ6Ô6ð 
	'ð 
	'ˆDØ�AŒw˜"Š}ˆ}Ø"Ô1°$°q´'Ô:�Ý�L¨,¸¸a¼Ñ*@ÑAÔA�Ý& {°AÑ6Ô6�
�
à#Ô2°4¸´7Ô;¸TÀ!¼WÐE�Ý�L¨,¸¸a¼Ñ*@ÑAÔA�Ý& {µIÔ4EÀaÈÈaÌÑ4QÔ4QÑRÔR�
à�NŠN˜:Ñ&Ô&Ð&Ð&à”^×'Ò'¨¨zÑ:Ô:ˆ
Ø”_×(Ò(¨°Ñ<Ô<ˆ
Ø˜7Ð"Ð"r   r   ÚrequestÚresponseÚtimec                 ó@   — |€dS |j                              | d¦  «        S )Nz(no headers)ú-©Úheadersr:   ©r   rT   rU   rV   s       r   Ú	_format_izAccessLogger._format_i~   s(   € ð ˆ?Ø!�>ð Œ×"Ò" 3¨Ñ,Ô,Ð,r   c                 ó8   — |j                              | d¦  «        S ©NrX   rY   r[   s       r   Ú	_format_ozAccessLogger._format_oˆ   s   € ð
 Ô×#Ò# C¨Ñ-Ô-Ð-r   c                 ó$   — | €dS | j         }|�|ndS r^   )Úremote)rT   rU   rV   Úips       r   Ú	_format_azAccessLogger._format_a�   s!   € àˆ?Ø�3ØŒ^ˆØ�^ˆrˆr¨Ð,r   c                 ó
  — | j         �t          j        ¦   «         | j        k    r½t          j        ¦   «         j        }t          j        t          j        |¬¦  «        ¦  «        x| _         }t          j         	                    |¦  «        }|t          j        d¬¦  «        z   }| 
                    |j        dk    rdnddd¬¦  «        }|                     ¦   «         | _        |S t          j         	                    | j         ¦  «        S )N©Úsecondsé   )Úminutesr   )ÚminuteÚsecondÚmicrosecond)r2   Útime_modrV   r3   Ú	localtimeÚ	tm_gmtoffÚdatetimeÚtimezoneÚ	timedeltaÚnowÚreplaceri   Ú	timestamp)ÚclsÚgmtoffÚtzrr   Úds        r   Ú_get_local_timezAccessLogger._get_local_time–   sÕ   € àŒ>Ð!¥X¤]¡_¤_¸Ô8NÒ%NÐ%NÝÔ'Ñ)Ô)Ô3ˆFÝ"*Ô"3µHÔ4FÈvÐ4VÑ4VÔ4VÑ"WÔ"WÐWˆCŒN˜RåÔ#×'Ò'¨Ñ+Ô+ˆCà•hÔ(°Ð4Ñ4Ô4Ñ4ˆAØ—	’	 q¤x°2¢~ ~  ¸1ÀQÐTU�	ÑVÔVˆAØ%&§[¢[¡]¤]ˆCÔ"ØˆJåÔ ×$Ò$ S¤^Ñ4Ô4Ð4r   c                 óŽ   — t                                ¦   «         }|t          j        |¬¦  «        z
  }|                     d¦  «        S )Nre   z[%d/%b/%Y:%H:%M:%S %z])r   ry   ro   rq   Ústrftime)rT   rU   rV   rr   Ú
start_times        r   Ú	_format_tzAccessLogger._format_t¥   s@   € å×*Ò*Ñ,Ô,ˆØ�8Ô-°dÐ;Ñ;Ô;Ñ;ˆ
Ø×"Ò"Ð#;Ñ<Ô<Ð<r   c                 ó.   — dt          j        ¦   «         z  S )Nz<%s>)ÚosÚgetpid©rT   rU   rV   s      r   Ú	_format_PzAccessLogger._format_P«   s   € à�œ	™œÑ#Ð#r   c                 ó`   — | €dS | j         › d| j        › d| j        j        › d| j        j        › �S )NrX   ú z HTTP/ú.)r   Úpath_qsÚversionÚmajorÚminorr�   s      r   Ú	_format_rzAccessLogger._format_r¯   s@   € àˆ?Ø�3Ø”.ÐiÐi 7¤?ÐiÐi¸'¼/Ô:OÐiÐiÐRYÔRaÔRgÐiÐiÐir   c                 ó   — |j         S ©N)Ústatusr�   s      r   Ú	_format_szAccessLogger._format_sµ   s
   € àŒÐr   c                 ó   — |j         S rŒ   )Úbody_lengthr�   s      r   Ú	_format_bzAccessLogger._format_b¹   s   € àÔ#Ð#r   c                 ó:   — t          t          |¦  «        ¦  «        S rŒ   ©r   Úroundr�   s      r   Ú	_format_TzAccessLogger._format_T½   s   € å•5˜‘;”;ÑÔÐr   c                 ó   — d|z  S )Nz%06fr   r�   s      r   Ú
_format_TfzAccessLogger._format_TfÁ   s   € à˜‰}Ðr   c                 ó@   — t          t          |dz  ¦  «        ¦  «        S )Ni@B r“   r�   s      r   Ú	_format_DzAccessLogger._format_DÅ   s   € å•5˜ ™Ñ(Ô(Ñ)Ô)Ð)r   c                 ó2   ‡‡‡— ˆˆˆfd„| j         D ¦   «         S )Nc                 ó4   •— g | ]\  }}| |‰‰‰¦  «        f‘ŒS r   r   )Ú.0r   r   rT   rU   rV   s      €€€r   ú
<listcomp>z-AccessLogger._format_line.<locals>.<listcomp>Ì   s0   ø€ ÐXÐXÐX¹;¸3À��f�f˜W h°Ñ5Ô5Ð6ÐXÐXÐXr   )r=   )r>   rT   rU   rV   s    ```r   Ú_format_linezAccessLogger._format_lineÉ   s*   øøø€ ð YÐXÐXÐXÐXÐXÈ$Ì-ÐXÑXÔXÐXr   c                 óJ   — | j                              t          j        ¦  «        S )zCheck if logger is enabled.)r4   ÚisEnabledForÚloggingÚINFO)r>   s    r   ÚenabledzAccessLogger.enabledÎ   s   € ð Œ{×'Ò'­¬Ñ5Ô5Ð5r   c                 óà  — 	 |                       |||¦  «        }t          ¦   «         }t          ¦   «         }|D ]Z\  }}|                     |¦  «         t	          |t
          ¦  «        r|||<   Œ5|\  }	}
|                     |	i ¦  «        }|||
<   |||	<   Œ[| j                             | j	        t          |¦  «        z  |¬¦  «         d S # t          $ r | j                             d¦  «         Y d S w xY w)N)ÚextrazError in logging)rž   rD   ÚdictrK   Ú
isinstancer   r:   r4   Úinfor<   r   Ú	ExceptionÚ	exception)r>   rT   rU   rV   Úfmt_infoÚvaluesr¥   r   ÚvalueÚk1Úk2Údcts               r   ÚlogzAccessLogger.logÔ   s  € ð	6Ø×(Ò(¨°(¸DÑAÔAˆHå‘V”VˆFÝ59±V´VˆEØ&ð 	$ð 	$‘
��UØ—’˜eÑ$Ô$Ð$å˜c¥3Ñ'Ô'ð $Ø!&�E˜#‘J�Jà ‘F�B˜Ø*/¯)ª)°B¸Ñ*;Ô*;�CØ#�C˜‘GØ #�E˜"‘I�IàŒK×Ò˜TÔ-µ°f±´Ñ=ÀUÐÑKÔKÐKÐKÐKøÝð 	6ð 	6ð 	6ØŒK×!Ò!Ð"4Ñ5Ô5Ð5Ð5Ð5Ð5ð	6øøøs   ‚CC Ã$C-Ã,C-)3r   r   r   Ú__doc__rG   Ú
LOG_FORMATÚreÚcompilerE   rM   r1   r¦   r   r   rD   r   r   r2   r   ro   rp   r3   r   r¡   ÚLoggerr9   r;   Ústaticmethodr	   r
   r\   r_   rc   Úclassmethodry   r}   r‚   rŠ   ÚintrŽ   r‘   r•   r—   r™   r   rž   ÚpropertyÚboolr£   r±   Ú__classcell__)r@   s   @r   r   r      så  ø€ € € € € € ðð ð6 Ø!ØØ!ØØØØ!Ø!ØØðð €Nð C€JØ�”
ÐLÑMÔM€IØ�”˜JÑ'Ô'€JØ<>€M�4˜˜U 3¨¨Y¬Ð#7Ô8Ð8Ô9Ð>Ð>Ñ>à59€J�˜Ô*¨TÑ1Ô2Ð9Ð9Ñ9Ø*-Ð˜ œÐ-Ð-Ñ-àAKð ;ð ;˜wœ~ð ;¸3ð ;ÐPTð ;ð ;ð ;ð ;ð ;ð ;ð '#¨ð '#°°s¸DÀ¼OÐ7KÔ1Lð '#ð '#ð '#ð '#ðR ð-Øð-Ø&ð-Ø2@ð-ØHMð-à	ð-ð -ð -ñ „\ð-ð ð.Øð.Ø&ð.Ø2@ð.ØHMð.à	ð.ð .ð .ñ „\ð.ð ð-˜;ð -°.ð -Èð -ÐRUð -ð -ð -ñ „\ð-ð ð5 Ô 1ð 5ð 5ð 5ñ „[ð5ð ð=˜;ð =°.ð =Èð =ÐRUð =ð =ð =ñ „\ð=ð
 ð$˜;ð $°.ð $Èð $ÐRUð $ð $ð $ñ „\ð$ð ðj˜;ð j°.ð jÈð jÐRUð jð jð jñ „\ðjð
 ð˜;ð °.ð Èð ÐRUð ð ð ñ „\ðð ð$˜;ð $°.ð $Èð $ÐRUð $ð $ð $ñ „\ð$ð ð ˜;ð  °.ð  Èð  ÐRUð  ð  ð  ñ „\ð ð ð˜Kð °>ð Èð ÐSVð ð ð ñ „\ðð ð*˜;ð *°.ð *Èð *ÐRUð *ð *ð *ñ „\ð*ðYØ"ðYØ.<ðYØDIðYà	�%˜˜e C¨ HœoÑ-¨sÐ2Ô3Ô	4ðYð Yð Yð Yð
 ð6˜ð 6ð 6ð 6ñ „Xð6ð
6˜;ð 6°.ð 6Èð 6ÐRVð 6ð 6ð 6ð 6ð 6ð 6ð 6ð 6r   r   )ro   rI   r¡   r   r´   rV   rl   Úcollections.abcr   Útypingr   r   r   Úabcr   Úweb_requestr	   Úweb_responser
   r   r   r   r   r   ú<module>rÂ      s  ðØ €€€Ø Ð Ð Ð Ø €€€Ø 	€	€	€	Ø 	€	€	€	Ø Ð Ð Ð Ø $Ð $Ð $Ð $Ð $Ð $Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1à %Ð %Ð %Ð %Ð %Ð %Ø $Ð $Ð $Ð $Ð $Ð $Ø (Ð (Ð (Ð (Ð (Ð (ð@ð @ð @ð @ð @�
ñ @ô @ð @ð
S6ð S6ð S6ð S6ð S6Ð'ñ S6ô S6ð S6ð S6ð S6r   