
    hU	                          d dl Z  G d d      Zy)    Nc                   &    e Zd ZdZd Zd Z	 ddZy)AccessLogGeneratorz
    Object that implements the Daphne "action logger" internal interface in
    order to provide an access log in something resembling NCSA format.
    c                     || _         y )N)stream)selfr   s     I/var/www/Befach/backend/env/lib/python3.12/site-packages/daphne/access.py__init__zAccessLogGenerator.__init__
   s	        c                    |dk(  rD|dk(  r?| j                  |d   t        j                  j                         d|z  |d   |d          y|dk(  r<|d	k(  r7| j                  |d   t        j                  j                         d
|z         y|dk(  r<|dk(  r7| j                  |d   t        j                  j                         d|z         y|dk(  r<|dk(  r7| j                  |d   t        j                  j                         d|z         y|dk(  r=|dk(  r7| j                  |d   t        j                  j                         d|z         yyy)zP
        Called when an action happens; use it to generate log entries.
        httpcompleteclientz%(method)s %(path)sstatussize)hostdaterequestr   length	websocket
connectingzWSCONNECTING %(path)s)r   r   r   rejectedzWSREJECT %(path)s	connectedzWSCONNECT %(path)sdisconnectedzWSDISCONNECT %(path)sN)write_entrydatetimenow)r   protocolactiondetailss       r   __call__zAccessLogGenerator.__call__   sx   
 v&J"6X&&&**,-7x(v   $<)?X&&&**,/'9  
 $:)=X&&&**,+g5  
 $;)>X&&&**,,w6  
 $>)AX&&&**,/'9   *B$r
   Nc                     | j                   j                  |d|xs dd|xs dd|j                  d      d|d|xs dd|xs dd       y)	z
        Writes an NCSA-style entry to the log file (some liberty is taken with
        what the entries are for non-HTTP)
         -z [z%d/%b/%Y:%H:%M:%Sz] "z" 
N)r   writestrftime)r   r   r   r   r   r   identusers           r   r   zAccessLogGenerator.write_entry4   sT     	 12##		
r
   )NNNN)__name__
__module____qualname____doc__r	   r    r    r
   r   r   r      s    
%P OS
r
   r   )r   r   r-   r
   r   <module>r.      s    B
 B
r
   