Ë
    ‹V.j‘  ã                   ó¬   — 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mZmZmZ ddlmZ ddlmZ ddlmZ  edd	«      Z G d
„ de«      Zy)é    N)Ú
namedtuple)ÚAnyÚCallableÚDictÚIterableÚListÚTupleé   )ÚAbstractAccessLogger)ÚBaseRequest)ÚStreamResponseÚ	KeyMethodz
key methodc                   óÞ  ‡ — 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<   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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egef   f      fd'„Z'e(de)fd(„«       Z*dedededdfd)„Z+ˆ xZ,S )*Ú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_CACHEÚloggerÚ
log_formatÚreturnNc                 óÐ   •— t         ‰| �  ||¬«       t        j                  j	                  |«      }|s$| j                  |«      }|t        j                  |<   |\  | _        | _        y)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.

        )r)   N)ÚsuperÚ__init__r   r'   ÚgetÚcompile_formatÚ_log_formatÚ_methods)Úselfr(   r)   Ú_compiled_formatÚ	__class__s       €úQC:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\aiohttp/web_log.pyr-   zAccessLogger.__init__?   sa   ø€ ô 	‰Ñ˜¨JÐÔ7ä'×5Ñ5×9Ñ9¸*ÓEÐÙØ#×2Ñ2°:Ó>ÐØ5EŒL×&Ñ& zÑ2à*:Ñ'ˆÔ˜$�-ó    c           	      ó
  — t        «       }| j                  j                  |«      D ]   }|d   dk(  r5| j                  |d      }t	        t
        d|d   z  «      }t        ||«      }nP| j                  |d      |d   f}t	        t
        d|d   z  «      }t        |t        j                  ||d   «      «      }|j                  |«       Œ¢ | j                  j                  d|«      }| j                  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)r2   r)   ÚmethodsÚatomÚformat_key1ÚmÚ
key_methodÚformat_key2s           r5   r/   zAccessLogger.compile_formatO   sø   € ô. “&ˆà—N‘N×*Ñ*¨:Ö6ˆDØ�A‰w˜"Š}Ø"×1Ñ1°$°q±'Ñ:�ÜœL¨,¸¸a¹Ñ*@ÓA�Ü& {°AÓ6‘
à#×2Ñ2°4¸±7Ñ;¸TÀ!¹WÐE�ÜœL¨,¸¸a¹Ñ*@ÓA�Ü& {´I×4EÑ4EÀaÈÈaÉÓ4QÓR�
à�N‰N˜:Õ&ð 7ð —^‘^×'Ñ'¨¨zÓ:ˆ
Ø—_‘_×(Ñ(¨°Ó<ˆ
Ø˜7Ð"Ð"r6   ÚkeyÚrequestÚresponseÚtimec                 ó@   — |€y|j                   j                  | d«      S )Nz(no headers)Ú-©Úheadersr.   ©rJ   rK   rL   rM   s       r5   Ú	_format_izAccessLogger._format_ix   s%   € ð ˆ?Ø!ð �‰×"Ñ" 3¨Ó,Ð,r6   c                 ó:   — |j                   j                  | d«      S ©NrO   rP   rR   s       r5   Ú	_format_ozAccessLogger._format_o‚   s   € ð
 ×Ñ×#Ñ# C¨Ó-Ð-r6   c                 ó,   — | €y| j                   }|�|S dS rU   )Úremote)rK   rL   rM   Úips       r5   Ú	_format_azAccessLogger._format_a‰   s"   € àˆ?ØØ�^‰^ˆØ�^ˆrÐ,¨Ð,r6   c                 ó  — t        j                  t        j                  t        j                   ¬«      «      }t         j                   j	                  |«      }|t        j                  |¬«      z
  }|j                  d«      S )N)Úsecondsz[%d/%b/%Y:%H:%M:%S %z])ÚdatetimeÚtimezoneÚ	timedeltaÚtime_modÚnowÚstrftime)rK   rL   rM   Útzra   Ú
start_times         r5   Ú	_format_tzAccessLogger._format_t�   sc   € ä×Ñœx×1Ñ1¼8×;LÑ;LÐ:LÔMÓNˆÜ×Ñ×#Ñ# BÓ'ˆØœ8×-Ñ-°dÔ;Ñ;ˆ
Ø×"Ñ"Ð#;Ó<Ð<r6   c                 ó0   — dt        j                  «       z  S )Nz<%s>)ÚosÚgetpid©rK   rL   rM   s      r5   Ú	_format_PzAccessLogger._format_P—   s   € àœŸ	™	›Ñ#Ð#r6   c                 ó¨   — | €ydj                  | j                  | j                  | j                  j                  | j                  j
                  «      S )NrO   z{} {} HTTP/{}.{})ÚformatÚmethodÚpath_qsÚversionÚmajorÚminorri   s      r5   Ú	_format_rzAccessLogger._format_r›   sE   € àˆ?ØØ!×(Ñ(Ø�N‰NØ�O‰OØ�O‰O×!Ñ!Ø�O‰O×!Ñ!ó	
ð 	
r6   c                 ó   — |j                   S ©N)Ústatusri   s      r5   Ú	_format_szAccessLogger._format_s¦   s   € à�‰Ðr6   c                 ó   — |j                   S rt   )Úbody_lengthri   s      r5   Ú	_format_bzAccessLogger._format_bª   s   € à×#Ñ#Ð#r6   c                 ó*   — t        t        |«      «      S rt   ©ÚstrÚroundri   s      r5   Ú	_format_TzAccessLogger._format_T®   s   € ä”5˜“;ÓÐr6   c                 ó   — d|z  S )Nz%06f© ri   s      r5   Ú
_format_TfzAccessLogger._format_Tf²   s   € à˜‰}Ðr6   c                 ó0   — t        t        |dz  «      «      S )Ni@B r{   ri   s      r5   Ú	_format_DzAccessLogger._format_D¶   s   € ä”5˜ ™Ó(Ó)Ð)r6   c           
      ó`   — | j                   D ��cg c]  \  }}| ||||«      f‘Œ c}}S c c}}w rt   )r1   )r2   rK   rL   rM   rJ   rm   s         r5   Ú_format_linezAccessLogger._format_lineº   s4   € ð KOÏ-Ê-ÔXÉ-¹;¸3À�‘f˜W h°Ó5Ò6È-ÒXÐXùÓXs   �*c                 óT   — | j                   j                  t        j                  «      S )zCheck if logger is enabled.)r(   ÚisEnabledForÚloggingÚINFO)r2   s    r5   ÚenabledzAccessLogger.enabled¿   s   € ð �{‰{×'Ñ'¬¯©Ó5Ð5r6   c                 ó¶  — 	 | j                  |||«      }t        «       }t        «       }|D ]O  \  }}|j                  |«       |j                  t
        u r|||<   Œ/|\  }	}
|j                  |	i «      }|||
<   |||	<   ŒQ | j                  j                  | j                  t        |«      z  |¬«       y # t        $ r | j                  j                  d«       Y y w xY w)N)ÚextrazError in logging)r…   r:   ÚdictrA   r4   r|   r.   r(   Úinfor0   ÚtupleÚ	ExceptionÚ	exception)r2   rK   rL   rM   Úfmt_infoÚvaluesrŒ   rJ   ÚvalueÚk1Úk2Údcts               r5   ÚlogzAccessLogger.logÅ   sÍ   € ð	6Ø×(Ñ(¨°(¸DÓAˆHä“VˆFÜ“FˆEÛ&‘
��UØ—‘˜eÔ$à—=‘=¤CÑ'Ø!&�E˜#’Jà ‘F�B˜ØŸ)™) B¨Ó+�CØ#�C˜‘GØ #�E˜"’Ið 'ð �K‰K×Ñ˜T×-Ñ-´°f³Ñ=ÀUÐÕKøÜò 	6Ø�K‰K×!Ñ!Ð"4Ö5ð	6ús   ‚B.B1 Â1$CÃC)-Ú__name__Ú
__module__Ú__qualname__Ú__doc__r=   Ú
LOG_FORMATÚreÚcompiler;   rC   r'   r   r|   r	   r   r   Ú__annotations__rˆ   ÚLoggerr-   r/   Ústaticmethodr   r   ÚfloatrS   rV   rZ   re   rj   rr   Úintrv   ry   r~   r�   rƒ   r   r   r…   ÚpropertyÚboolrŠ   r˜   Ú__classcell__)r4   s   @r5   r   r      sy  ø… ñð6 Ø!ØØ!ØØØØ!Ø!ØØñ€Nð C€JØ�—
‘
ÐLÓM€IØ�—‘˜JÓ'€JØ<>€M�4˜˜U 3¨¨Y©Ð#7Ñ8Ð8Ñ9Ó>àAKñ ;˜wŸ~™~ð ;¸3ð ;ÐPTõ ;ð '#¨ð '#°°s¸DÀ¹OÐ7KÑ1Ló '#ðR ð-Øð-Ø&ð-Ø2@ð-ØHMð-à	ò-ó ð-ð ð.Øð.Ø&ð.Ø2@ð.ØHMð.à	ò.ó ð.ð ð-˜;ð -°.ð -Èð -ÐRUò -ó ð-ð ð=˜;ð =°.ð =Èð =ÐRUò =ó ð=ð ð$˜;ð $°.ð $Èð $ÐRUò $ó ð$ð ð
˜;ð 
°.ð 
Èð 
ÐRUò 
ó ð
ð ð˜;ð °.ð Èð ÐRUò ó ðð ð$˜;ð $°.ð $Èð $ÐRUò $ó ð$ð ð ˜;ð  °.ð  Èð  ÐRUò  ó ð ð ð˜Kð °>ð Èð ÐSVò ó ðð ð*˜;ð *°.ð *Èð *ÐRUò *ó ð*ðYØ"ðYØ.<ðYØDIðYà	�%˜˜X {°NÀEÐ&JÈCÐ&OÑPÐPÑQÑ	RóYð
 ð6˜ò 6ó ð6ð
6˜;ð 6°.ð 6Èð 6ÐRV÷ 6r6   r   )r]   r?   rˆ   rg   rž   rM   r`   Úcollectionsr   Útypingr   r   r   r   r   r	   Úabcr   Úweb_requestr   Úweb_responser   r   r   r€   r6   r5   Ú<module>r­      sD   ðÛ Û Û Û 	Û 	Û Ý "ß =× =å %Ý $Ý (á�{ LÓ1€	ôG6Ð'õ G6r6   