File: //home/arjun/projects/env/lib/python3.10/site-packages/boto/__pycache__/requestlog.cpython-310.pyc
o
we� � @ sT d dl Z d dlmZ d dlmZ d dlZd dlmZ d dlmZ G dd� de�Z dS )� N)�datetime)�Thread)�RequestHook)� long_typec @ s, e Zd ZdZddd�Zddd�Zdd � Zd
S )
�
RequestLoggerzf
This class implements a request logger that uses a single thread to
write to a log file.
�/tmp/request_log.csvc C s, t |d�| _t�d�| _t| jd��� d S )N�w�d )�target)�open�request_log_file�Queue�request_log_queuer �_request_log_worker�start)�self�filename� r �H/home/arjun/projects/env/lib/python3.10/site-packages/boto/requestlog.py�__init__ s zRequestLogger.__init__Fc C sz |rdn|� d�}t�� }|�d�}||j }|jt|j|jd d �d d }| j �
d||j|||jd f � d S ) Nr zContent-Lengthz%Y-%m-%d %H:%M:%S� i g ��.Az'%s', '%s', '%s', '%s', '%s'
�Action)
� getheaderr �now�strftime�
start_time�microsecondsr �seconds�daysr �put�status�params) r �request�response�error�lenr �time�td�durationr r r �handle_request_data s
&&z!RequestLogger.handle_request_datac C sT z| j �d�}| j�|� | j�� | j �� W n dd l}|jtj d� Y q)NTr )�file)
r �getr �write�flush� task_done� traceback� print_exc�sys�stdout)r �itemr/ r r r r s
�z!RequestLogger._request_log_workerN)r )F)�__name__�
__module__�__qualname__�__doc__r r) r r r r r r
s
r )
r1 r � threadingr r
�
boto.utilsr �boto.compatr r r r r r �<module> s