
    z
g]	                     *    d dl Z  G d de          ZdS )    Nc                   (    e Zd ZdZd Zd Z	 ddZdS )AccessLogGeneratorz
    Object that implements the Daphne "action logger" internal interface in
    order to provide an access log in something resembling NCSA format.
    c                     || _         d S )N)stream)selfr   s     ?/var/www/html/env/lib/python3.11/site-packages/daphne/access.py__init__zAccessLogGenerator.__init__
   s        c                    |dk    rS|dk    rM|                      |d         t          j                                        d|z  |d         |d                    dS |dk    rE|d	k    r?|                      |d         t          j                                        d
|z             dS |dk    rE|dk    r?|                      |d         t          j                                        d|z             dS |dk    rE|dk    r?|                      |d         t          j                                        d|z             dS |dk    rE|dk    rA|                      |d         t          j                                        d|z             dS dS dS )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__   s   
 v&J"6"6X&&**,,-7x(v       $$<)?)?X&&**,,/'9      
 $$:)=)=X&&**,,+g5      
 $$;)>)>X&&**,,,w6      
 $$>)A)AX&&**,,/'9       %$)A)Ar
   Nc                     | j                             |d|pdd|pdd|                    d          d|d|pdd|pdd           dS )	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   s     	 12222##		
 	
 	
 	
 	
r
   )NNNN)__name__
__module____qualname____doc__r	   r    r    r
   r   r   r      sX         
  % % %P OS
 
 
 
 
 
r
   r   )r   objectr   r-   r
   r   <module>r/      sL    B
 B
 B
 B
 B
 B
 B
 B
 B
 B
r
   