o ckF[@sTddlZddlmZddlmZddlZddlmZddlmZGdddeZ dS)N)datetime)Thread) RequestHook) long_typec@s,eZdZdZd ddZd ddZdd Zd S) RequestLoggerzf This class implements a request logger that uses a single thread to write to a log file. /tmp/request_log.csvcCs,t|d|_td|_t|jddS)Nwd)target)openrequest_log_fileQueuerequest_log_queuer_request_log_workerstart)selffilenamer1/usr/lib/python3/dist-packages/boto/requestlog.py__init__s  zRequestLogger.__init__Fc Csz|rdn|d}t}|d}||j}|jt|j|jdddd}|j d||j |||j dfdS) NrzContent-Lengthz%Y-%m-%d %H:%M:%Sig.Az'%s', '%s', '%s', '%s', '%s' Action) getheaderrnowstrftime start_time microsecondsrsecondsdaysrputstatusparams) rrequestresponseerrorlenrtimetddurationrrrhandle_request_datas   &&z!RequestLogger.handle_request_datacCsT z|jd}|j||j|jWnddl}|jtj dYq)NTr)file) rgetr writeflush task_done traceback print_excsysstdout)ritemr/rrrrs   z!RequestLogger._request_log_workerN)r)F)__name__ __module__ __qualname____doc__rr)rrrrrr s    r) r1r threadingrr boto.utilsr boto.compatrrrrrrs