o
    >hU	                     @   s   d dl Z G dd dZdS )    Nc                   @   s,   e Zd ZdZdd Zdd Z	d	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                 C   s
   || _ d S )N)stream)selfr    r   m/var/www/vedio/testing/chatpythonscript.ninositsolution.com/env/lib/python3.10/site-packages/daphne/access.py__init__
   s   
zAccessLogGenerator.__init__c                 C   s  |dkr|dkr| j |d tj d| |d |d d dS |dkr8|d	kr8| j |d tj d
| d dS |dkrQ|dkrQ| j |d tj d| d dS |dkrj|dkrj| j |d tj d| d dS |dkr|dkr| j |d tj d| d 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detailsr   r   r   __call__   sB   




zAccessLogGenerator.__call__Nc              
   C   s8   | j d||pd|pd|d||pd|pdf  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%s %s %s [%s] "%s" %s %s
-z%d/%b/%Y:%H:%M:%SN)r   writestrftime)r   r   r   r   r   r   identuserr   r   r   r   4   s   zAccessLogGenerator.write_entry)NNNN)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r      s    (r   )r   r   r   r   r   r   <module>   s    