Ϫf! dZddlmZmZmZmZddlmZddlm Z ddl m Z m Z m Z ddlmZmZeeGdd Ze fd eed eed efd Zy)z File log observer. )IOAnyCallableOptional) implementer)ioType)formatEventAsClassicLogText formatTimetimeFormatRFC3339) ILogObserverLogEventcLeZdZdZdeedeegee fddfdZ deddfdZ y) FileLogObserverz9 Log observer that writes to a file-like object. outFile formatEventreturnNc`t|turd|_nd|_||_||_y)z @param outFile: A file-like object. Ideally one should be passed which accepts text data. Otherwise, UTF-8 L{bytes} will be used. @param formatEvent: A callable that formats an event. zutf-8N)rstr _encoding_outFiler)selfrrs 6/usr/lib/python3/dist-packages/twisted/logger/_file.py__init__zFileLogObserver.__init__s- '?# %,3DN!DN &eventc|j|}|rw|j|jj|n4|jj|j |j|jj yy)zG Write event to file. @param event: An event. N)rrrwriteencodeflush)rrtexts r__call__zFileLogObserver.__call__(sg & ~~% ##D) ##DKK$?@ MM   ! r) __name__ __module__ __qualname____doc__rrrrrrrr"rrrrsK'#w'-5xj(3-6O-P' ' "h "4 "rrr timeFormatrcNdtdttffd }t||S)a Create a L{FileLogObserver} that emits text to a specified (writable) file-like object. @param outFile: A file-like object. Ideally one should be passed which accepts text data. Otherwise, UTF-8 L{bytes} will be used. @param timeFormat: The format to use when adding timestamp prefixes to logged events. If L{None}, or for events with no C{"log_timestamp"} key, the default timestamp prefix of C{"-"} is used. @return: A file log observer. rrc$t|fdS)Nct|S)Nr )er(s rz:textFileLogObserver..formatEvent..Js 1j(Arr,)r )rr(s rrz(textFileLogObserver..formatEventHs* A  r)rrrr)rr(rs ` rtextFileLogObserverr/8s)  8   7K 00rN)r&typingrrrrzope.interfacertwisted.python.compatr_formatr r r _interfacesr rrrr/r'rrr5sk /.&(OO/ \""""""L3D1 W1"*3-11r