x3x3x3x_5h3ll
— 53cur3 — 5h3ll_1d —
Linux vps-10654784.cedaps.org.br 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
  INFO SERVER : Apache PHP : 7.4.33
/lib64/python3.6/logging/__pycache__/
162.240.100.168

 
[ NAME ] [ SIZE ] [ PERM ] [ DATE ] [ ACTN ]
+FILE +DIR
__init__.cpython-36.opt-1.pyc 58.942 KB -rw-r--r-- 2024-09-24 14:12 R E G D
__init__.cpython-36.opt-2.pyc 31.756 KB -rw-r--r-- 2024-09-24 14:11 R E G D
__init__.cpython-36.pyc 58.974 KB -rw-r--r-- 2024-09-24 14:12 R E G D
config.cpython-36.opt-1.pyc 22.787 KB -rw-r--r-- 2024-09-24 14:12 R E G D
config.cpython-36.opt-2.pyc 18.771 KB -rw-r--r-- 2024-09-24 14:11 R E G D
config.cpython-36.pyc 22.834 KB -rw-r--r-- 2024-09-24 14:12 R E G D
handlers.cpython-36.opt-1.pyc 42.232 KB -rw-r--r-- 2024-09-24 14:12 R E G D
handlers.cpython-36.opt-2.pyc 23.706 KB -rw-r--r-- 2024-09-24 14:11 R E G D
handlers.cpython-36.pyc 42.232 KB -rw-r--r-- 2024-09-24 14:12 R E G D
REQUEST EXIT
3 \ @sdZddlZddlZddlZddlZddlZddlZddlZddlm Z m Z m Z ddl Z y ddl Z Wnek r|dZ YnXdZdZdZdZdZdZd(ZGd d d ejZGd ddeZGdddeZGdddejZGdddejZGdddeZGdddejZGdddejZGdddejZ GdddejZ!Gdd d ejZ"Gd!d"d"e"Z#Gd#d$d$ejZ$e rGd%d&d&e%Z&dS))z Additional handlers for the logging package for Python. The core package is based on PEP 282 and comments thereto in comp.lang.python. Copyright (C) 2001-2016 Vinay Sajip. All Rights Reserved. To use, simply 'import logging.handlers' and log away! N)ST_DEVST_INOST_MTIMEi<#i=#i>#i?#i<c@s2eZdZdZd ddZddZdd Zd d ZdS) BaseRotatingHandlerz Base class for handlers that rotate log files at a certain point. Not meant to be instantiated directly. Instead, use RotatingFileHandler or TimedRotatingFileHandler. NFcCs0tjj|||||||_||_d|_d|_dS)zA Use the specified filename for streamed logging N)logging FileHandler__init__modeencodingnamerrotator)selffilenamer r delayr /usr/lib64/python3.6/handlers.pyr 5s zBaseRotatingHandler.__init__c CsHy$|j|r|jtjj||Wntk rB|j|YnXdS)z Emit a record. Output the record to the file, catering for rollover as described in doRollover(). N)shouldRollover doRolloverrr emit Exception handleError)rrecordrrrr?s  zBaseRotatingHandler.emitcCst|js|}n |j|}|S)a Modify the filename of a log file when rotating. This is provided so that a custom filename can be provided. The default implementation calls the 'namer' attribute of the handler, if it's callable, passing the default name to it. If the attribute isn't callable (the default is None), the name is returned unchanged. :param default_name: The default name for the log file. )callabler )rZ default_nameresultrrrrotation_filenameMs  z%BaseRotatingHandler.rotation_filenamecCs4t|js$tjj|r0tj||n |j||dS)aL When rotating, rotate the current log. The default implementation calls the 'rotator' attribute of the handler, if it's callable, passing the source and dest arguments to it. If the attribute isn't callable (the default is None), the source is simply renamed to the destination. :param source: The source filename. This is normally the base filename, e.g. 'test.log' :param dest: The destination filename. This is normally what the source is rotated to, e.g. 'test.log.1'. N)rrospathexistsrename)rsourcedestrrrrotate`s  zBaseRotatingHandler.rotate)NF)__name__ __module__ __qualname____doc__r rrr#rrrrr/s  rc@s*eZdZdZd ddZdd Zd d ZdS) RotatingFileHandlerz Handler for logging to a set of files, which switches from one file to the next when the current file reaches a certain size. arNFcCs.|dkr d}tj|||||||_||_dS)a Open the specified file and use it as the stream for logging. By default, the file grows indefinitely. You can specify particular values of maxBytes and backupCount to allow the file to rollover at a predetermined size. Rollover occurs whenever the current log file is nearly maxBytes in length. If backupCount is >= 1, the system will successively create new files with the same pathname as the base file, but with extensions ".1", ".2" etc. appended to it. For example, with a backupCount of 5 and a base file name of "app.log", you would get "app.log", "app.log.1", "app.log.2", ... through to "app.log.5". The file being written to is always "app.log" - when it gets filled up, it is closed and renamed to "app.log.1", and if files "app.log.1", "app.log.2" etc. exist, then they are renamed to "app.log.2", "app.log.3" etc. respectively. If maxBytes is zero, rollover never occurs. rr)N)rr maxBytes backupCount)rrr r*r+r rrrrr zs zRotatingFileHandler.__init__cCs|jr|jjd|_|jdkrxtt|jdddD]^}|jd|j|f}|jd|j|df}tjj|r4tjj|rtj |tj ||q4W|j|jd}tjj|rtj ||j |j||j s|j |_dS)z< Do a rollover, as described in __init__(). Nrz%s.%dz.1)streamcloser+ranger baseFilenamerrrremover r#r_open)riZsfndfnrrrrs$        zRotatingFileHandler.doRollovercCsZ|jdkr|j|_|jdkrVd|j|}|jjdd|jjt||jkrVdSdS)z Determine if rollover should occur. Basically, see if the supplied record would cause the file to exceed the size limit we have. Nrz%s r,)r.r3r*formatseektelllen)rrmsgrrrrs   z"RotatingFileHandler.shouldRollover)r)rrNF)r$r%r&r'r rrrrrrr(us r(c@s:eZdZdZdddZd d Zd d Zd dZddZdS)TimedRotatingFileHandlerz Handler for logging to a file, rotating the log file at certain timed intervals. If backupCount is > 0, when rollover is done, no more than backupCount files are kept - the oldest ones are deleted. hr,rNFc Cstj||d|||j|_||_||_||_|jdkrNd|_d|_d|_ n|jdkrld|_d|_d |_ n|jd krd|_d |_d |_ n|jd ks|jdkrd|_d|_d|_ n|jj dr.d|_t |jdkrt d|j|jddks|jddkrt d|jt |jd|_d|_d|_ nt d|jtj|j tj|_ |j||_|j}tjj|r~tj|t} n t tj} |j| |_dS) Nr)Sr,z%Y-%m-%d_%H-%M-%Sz-^\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}(\.\w+)?$Mrz%Y-%m-%d_%H-%Mz'^\d{4}-\d{2}-\d{2}_\d{2}-\d{2}(\.\w+)?$Hz %Y-%m-%d_%Hz!^\d{4}-\d{2}-\d{2}_\d{2}(\.\w+)?$DMIDNIGHTrz%Y-%m-%dz^\d{4}-\d{2}-\d{2}(\.\w+)?$Wr6zHYou must specify a day for weekly rollover from 0 to 6 (0 is Monday): %s06z-Invalid day specified for weekly rollover: %sz'Invalid rollover interval specified: %siiiQiiQi: )rr upperwhenr+utcatTimeintervalsuffixextMatch startswithr: ValueErrorint dayOfWeekrecompileASCIIr1rrrstatrtimecomputeRollover rolloverAt) rrrHrKr+r rrIrJtrrrr sL        z!TimedRotatingFileHandler.__init__cCsd||j}|jdks"|jjdr`|jr4tj|}n tj|}|d}|d}|d}|d}|jdkrnt}n |jj d|jj d|jj }||d|d|} | d kr| t7} |d d }|| }|jjdr`|} | |j kr`| |j kr|j | } nd| |j d } || d} |js\|d} tj| d}| |kr\| sPd}nd }| |7} | }|S)zI Work out the rollover time based on the specified time. rBrCNrrr,rDriiiQr-r-i) rKrHrNrIrVgmtime localtimerJ _MIDNIGHTZhourZminutesecondrQ)r currentTimerrYZ currentHourZ currentMinuteZ currentSecondZ currentDayZ rotate_tsrZdayZ daysToWait newRolloverAtdstNow dstAtRolloveraddendrrrrWsH           z(TimedRotatingFileHandler.computeRollovercCsttj}||jkrdSdS)z Determine if rollover should occur. record is not used, as we are just comparing times, but it is needed so the method signatures are the same r,r)rPrVrX)rrrYrrrrKs  z'TimedRotatingFileHandler.shouldRolloverc Cstjj|j\}}tj|}g}|d}t|}xH|D]@}|d||kr6||d}|jj|r6|jtjj ||q6Wt||j krg}n|j |dt||j }|S)z Determine the files to delete when rolling over. More specific than the earlier method, which just used glob.glob(). .N) rrsplitr1listdirr:rMmatchappendjoinr+sort) rZdirNameZbaseNameZ fileNamesrprefixZplenZfileNamerLrrrgetFilesToDeleteWs    z)TimedRotatingFileHandler.getFilesToDeletec Cs|jr|jjd|_ttj}tj|d}|j|j}|jrNtj|}n6tj|}|d }||kr|rrd}nd }tj||}|j |j dtj |j |}t jj|rt j||j|j ||jdkrx|jD]}t j|qW|js|j|_|j|} x| |kr"| |j} q W|jdks>|jjdrx|j rxtj| d } || krx|sld }nd}| |7} | |_dS) ax do a rollover; in this case, a date/time stamp is appended to the filename when the rollover happens. However, you want the file to be named for the start of the interval, not the current time. If there is a backup count, then we have to get a list of matching filenames, sort them and remove the one with the oldest suffix. Nr,irhrrBrCr-r-ir-i)r.r/rPrVr_rXrKrIr^rr1ZstrftimerLrrrr2r#r+rprr3rWrHrN) rrbrerYZ timeTupleZdstThenrgr5srdrfrrrrnsH            $ z#TimedRotatingFileHandler.doRollover)r=r,rNFFN) r$r%r&r'r rWrrprrrrrr<s  9I r<c@s2eZdZdZd ddZddZd d Zd d ZdS)WatchedFileHandlera A handler for logging to a file, which watches the file to see if it has changed while in use. This can happen because of usage of programs such as newsyslog and logrotate which perform log file rotation. This handler, intended for use under Unix, watches the file to see if it has changed since the last emit. (A file has changed if its device or inode have changed.) If it has changed, the old file stream is closed, and the file opened to get a new stream. This handler is not appropriate for use under Windows, because under Windows open files cannot be moved or renamed - logging opens the files with exclusive locks - and so there is no need for such a handler. Furthermore, ST_INO is not supported under Windows; stat always returns zero for this value. This handler is based on a suggestion and patch by Chad J. Schroeder. r)NFcCs,tjj|||||d\|_|_|jdS)Nr,r-r-)r-r-)rr r devino _statstream)rrr r rrrrr s zWatchedFileHandler.__init__cCs0|jr,tj|jj}|t|t|_|_dS)N)r.rfstatfilenorrrsrt)rsresrrrruszWatchedFileHandler._statstreamc Csytj|j}Wntk r(d}YnX| sL|t|jksL|t|jkr|jdk r|jj |jj d|_|j |_|j dS)z Reopen log file if needed. Checks if the underlying file has changed, and if it has, close the old stream and reopen the file to get the current stream. N) rrUr1FileNotFoundErrorrrsrrtr.flushr/r3ru)rrxrrrreopenIfNeededs  "    z!WatchedFileHandler.reopenIfNeededcCs|jtjj||dS)z Emit a record. If underlying file has changed, reopen the file before emitting the record to it. N)r{rr r)rrrrrrszWatchedFileHandler.emit)r)NF)r$r%r&r'r rur{rrrrrrrs  rrc@sReZdZdZddZdddZddZd d Zd d Zd dZ ddZ ddZ dS) SocketHandlera A handler class which writes logging records, in pickle format, to a streaming socket. The socket is kept open across logging calls. If the peer resets it, an attempt is made to reconnect on the next call. The pickle which is sent is that of the LogRecord's attribute dictionary (__dict__), so that the receiver does not need to have the logging module installed in order to process the logging event. To unpickle the record at the receiving end into a LogRecord, use the makeLogRecord function. cCsZtjj|||_||_|dkr(||_n ||f|_d|_d|_d|_d|_ d|_ d|_ dS)a Initializes the handler with a specific host address and port. When the attribute *closeOnError* is set to True - if a socket error occurs, the socket is silently closed and then reopened on the next logging call. NFg?g>@g@) rHandlerr hostportaddresssock closeOnError retryTime retryStartretryMax retryFactor)rr~rrrrr s  zSocketHandler.__init__r,c Csj|jdk rtj|j|d}nJtjtjtj}|j|y|j|jWntk rd|j YnX|S)zr A factory method which allows subclasses to define the precise type of socket they want. N)timeout) rsocketZcreate_connectionrAF_UNIX SOCK_STREAMZ settimeoutconnectOSErrorr/)rrrrrr makeSocket s  zSocketHandler.makeSocketc Cstj}|jdkrd}n ||jk}|ry|j|_d|_WnVtk r|jdkr^|j|_n"|j|j|_|j|jkr|j|_||j|_YnXdS)z Try to create a socket, using an exponential backoff with a max retry time. Thanks to Robert Olson for the original patch (SF #815911) which has been slightly refactored. NT) rVrrrrrZ retryPeriodrr)rZnowZattemptrrr createSockets       zSocketHandler.createSocketc CsR|jdkr|j|jrNy|jj|Wn$tk rL|jjd|_YnXdS)z Send a pickled string to the socket. This function allows for partial sends which can happen when the network is busy. N)rrsendallrr/)rrqrrrsend8s  zSocketHandler.sendcCsj|j}|r|j|}t|j}|j|d<d|d<d|d<|jddtj|d}tj dt |}||S)z Pickles the record in binary format with a length prefix, and returns it ready for transmission across the socket. r;Nargsexc_infomessager,z>L) rr7dict__dict__Z getMessagepoppickledumpsstructpackr:)rrZeiZdummydrqZslenrrr makePickleKs     zSocketHandler.makePicklecCs0|jr|jr|jjd|_ntjj||dS)z Handle an error during logging. An error has occurred during logging. Most likely cause - connection lost. Close the socket so that we can retry on the next event. N)rrr/rr}r)rrrrrras  zSocketHandler.handleErrorc Cs<y|j|}|j|Wntk r6|j|YnXdS)a Emit a record. Pickles the record and writes it to the socket in binary format. If there is an error with the socket, silently drop the packet. If there was a problem with the socket, re-establishes the socket. N)rrrr)rrrqrrrros  zSocketHandler.emitc Cs@|jz(|j}|r"d|_|jtjj|Wd|jXdS)z$ Closes the socket. N)acquirerr/rr}release)rrrrrr/~szSocketHandler.closeN)r,) r$r%r&r'r rrrrrrr/rrrrr|s  r|c@s(eZdZdZddZddZddZdS) DatagramHandlera A handler class which writes logging records, in pickle format, to a datagram socket. The pickle which is sent is that of the LogRecord's attribute dictionary (__dict__), so that the receiver does not need to have the logging module installed in order to process the logging event. To unpickle the record at the receiving end into a LogRecord, use the makeLogRecord function. cCstj|||d|_dS)zP Initializes the handler with a specific host address and port. FN)r|r r)rr~rrrrr szDatagramHandler.__init__cCs*|jdkrtj}ntj}tj|tj}|S)zu The factory method of SocketHandler is here overridden to create a UDP socket (SOCK_DGRAM). N)rrrZAF_INET SOCK_DGRAM)rZfamilyrqrrrrs  zDatagramHandler.makeSocketcCs&|jdkr|j|jj||jdS)z Send a pickled string to a socket. This function no longer allows for partial sends which can happen when the network is busy - UDP does not guarantee delivery and can deliver packets out of sequence. N)rrsendtor)rrqrrrrs zDatagramHandler.sendN)r$r%r&r'r rrrrrrrs  rc@s"eZdZdZdZdZdZdZdZdZ dZ d Z dZ dZ dZdZdZdZdZd Zd Zd Zd Zd ZdZdZdZdZdZdZdZdZeeee eeee e eeed Z eeeeee eeeeee eeeeeeeeedZ!ddddddZ"de#fe dfd d!Z$d"d#Z%d$d%Z&d&d'Z'd(d)Z(d*Z)d+Z*d,d-Z+dS). SysLogHandlera A handler class which sends formatted logging records to a syslog server. Based on Sam Rushing's syslog module: http://www.nightmare.com/squirl/python-ext/misc/syslog.py Contributed by Nicolas Untz (after which minor refactoring changes have been made). rr,r6rZr[r\r]rD ) ZalertZcritcriticaldebugZemergerrerrorinfoZnoticeZpanicwarnwarning)ZauthZauthprivZcrondaemonZftpZkernZlprZmailZnewsZsecurityZsysloguserZuucpZlocal0Zlocal1Zlocal2Zlocal3Zlocal4Zlocal5Zlocal6Zlocal7rrrrr)DEBUGINFOWARNINGERRORCRITICALZ localhostNcCs0tjj|||_||_||_t|trTd|_y|j |Wnt k rPYnXnd|_|dkrht j }|\}}t j ||d|}|st dx|D]|}|\}}} } } d} } y(t j ||| } |t jkr| j| PWqt k r }z|} | dk r| jWYdd}~XqXqW| dk r | | |_ ||_dS)a Initialize a handler. If address is specified as a string, a UNIX socket is used. To log to a local syslogd, "SysLogHandler(address="/dev/log")" can be used. If facility is not specified, LOG_USER is used. If socktype is specified as socket.SOCK_DGRAM or socket.SOCK_STREAM, that specific socket type will be used. For Unix sockets, you can also specify a socktype of None, in which case socket.SOCK_DGRAM will be used, falling back to socket.SOCK_STREAM. TFNrz!getaddrinfo returns an empty list)rr}r rfacilitysocktype isinstancestr unixsocket_connect_unixsocketrrrZ getaddrinforrr/)rrrrr~rZressresZafproto_Zsarrexcrrrr sB      zSysLogHandler.__init__cCs|j}|dkrtj}tjtj||_y|jj|||_Wnxtk r|jj|jdk r`tj}tjtj||_y|jj|||_Wn tk r|jjYnXYnXdS)N)rrrrrrr/r)rrZ use_socktyperrrrSs&       z!SysLogHandler._connect_unixsocketcCs4t|tr|j|}t|tr(|j|}|d>|BS)z Encode the facility and priority. You can pass in strings or integers - if strings are passed, the facility_names and priority_names mapping dictionaries are used to convert them to integers. rZ)rrfacility_namespriority_names)rrZpriorityrrrencodePriorityks     zSysLogHandler.encodePriorityc Cs2|jz|jjtjj|Wd|jXdS)z$ Closes the socket. N)rrr/rr}r)rrrrr/xs  zSysLogHandler.closecCs|jj|dS)aK Map a logging level name to a key in the priority_names map. This is useful in two scenarios: when custom levels are being used, and in the case where you can't do a straightforward mapping by lowercasing the logging level name because of locale- specific issues (see SF #1524081). r) priority_mapget)rZ levelNamerrr mapPriorityszSysLogHandler.mapPriorityTcCsy|j|}|jr|j|}|jr*|d7}d|j|j|j|j}|jd}|jd}||}|jry|j j |Wqt k r|j j |j |j|j j |YqXn*|jt jkr|j j||jn |j j|Wntk r|j|YnXdS)z Emit a record. The record is formatted, and then sent to the syslog server. If exception information is present, it is NOT sent to the server. z<%d>zutf-8N)r7ident append_nulrrrZ levelnameencoderrrrr/rrrrrrrr)rrr;Zpriorrrrs.        zSysLogHandler.emit),r$r%r&r'Z LOG_EMERGZ LOG_ALERTZLOG_CRITZLOG_ERRZ LOG_WARNINGZ LOG_NOTICEZLOG_INFOZ LOG_DEBUGZLOG_KERNZLOG_USERZLOG_MAILZ LOG_DAEMONZLOG_AUTHZ LOG_SYSLOGZLOG_LPRZLOG_NEWSZLOG_UUCPZLOG_CRONZ LOG_AUTHPRIVZLOG_FTPZ LOG_LOCAL0Z LOG_LOCAL1Z LOG_LOCAL2Z LOG_LOCAL3Z LOG_LOCAL4Z LOG_LOCAL5Z LOG_LOCAL6Z LOG_LOCAL7rrrSYSLOG_UDP_PORTr rrr/rrrrrrrrrs 5   rc@s*eZdZdZd ddZddZdd ZdS) SMTPHandlerzK A handler class which sends an SMTP email for each logging event. N@cCstjj|t|ttfr(|\|_|_n|d|_|_t|ttfrR|\|_|_ nd|_||_ t|t rn|g}||_ ||_ ||_||_dS)ax Initialize the handler. Initialize the instance with the from and to addresses and subject line of the email. To specify a non-standard SMTP port, use the (host, port) tuple format for the mailhost argument. To specify authentication credentials, supply a (username, password) tuple for the credentials argument. To specify the use of a secure protocol (TLS), pass in a tuple for the secure argument. This will only be used when authentication credentials are supplied. The tuple will be either an empty tuple, or a single-value tuple with the name of a keyfile, or a 2-value tuple with the names of the keyfile and certificate file. (This tuple is passed to the `starttls` method). A timeout in seconds can be specified for the SMTP connection (the default is one second). N)rr}r rlisttuplemailhostmailportusernamepasswordfromaddrrtoaddrssubjectsecurer)rrrrr credentialsrrrrrr s  zSMTPHandler.__init__cCs|jS)z Determine the subject for the email. If you want to specify a subject line which is record-dependent, override this method. )r)rrrrr getSubjectszSMTPHandler.getSubjectc Csyddl}ddlm}ddl}|j}|s.|j}|j|j||jd}|}|j |d<dj |j |d<|j ||d<|j j|d <|j|j||jr|jdk r|j|j|j|j|j|j|j|j||jWntk r|j|YnXdS) zd Emit a record. Format the record and send it to the specified addressees. rN) EmailMessage)rZFrom,ZToZSubjectZDate)smtplibZ email.messagerZ email.utilsrZ SMTP_PORTZSMTPrrrrmrrZutilsr_Z set_contentr7rrZehloZstarttlsZlo