a ª‡Ù`3ã @sædZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Zgd¢ZddlZdZdZdZd Ze ¡Zd Zd Zd Zd Zd ZeZd Zd ZeZdZdZ dZ!edededede de!diZ"eeeeeee e!dœZ#dd„Z$dd„Z%e&edƒrdd„Z'ndd„Z'ej( )e%j*j+¡Z,d d!„Z-e .¡Z/d"d#„Z0d$d%„Z1e&ed&ƒsbd'd(„Z2n(e 3¡Z4d)d(„Z2d*d+„Z5ej6e0e5e1d,Gd-d.„d.e7ƒZ8e8a9d/d0„Z:d1d2„Z;d3d4„ZGd7d8„d8e>ƒZ?Gd9d:„d:e>ƒZ@d;ZAe>eAfe?dœZBGd?d@„d@e7ƒZ e ƒZCGdAdB„dBe7ƒZDGdCdD„dDe7ƒZEGdEdF„dFe7ƒZFe G¡ZHgZIdGdH„ZJdIdJ„ZKGdKdL„dLeFƒZLGdMdN„dNeLƒZMGdOdP„dPeMƒZNGdQdR„dReMƒZOeOeƒZPePZQGdSdT„dTe7ƒZRdUdV„ZSdWdX„ZTGdYdZ„dZe7ƒZUGd[d\„d\eFƒZVGd]d^„d^eVƒZWeVaXGd_d`„d`e7ƒZYeWeƒZZeZeV_ZeUeVjZƒeV_[dadb„Z\d€dcdd„Z]dedf„Z^e^Z_dgdh„Z`d diœdjdk„Zadldm„Zbdndo„Zcdpdq„Zddrds„Zedtdu„Zfefdvdw„ZgeIfdxdy„ZhddliZiei jeh¡Gdzd{„d{eLƒZkdaldd|d}„Zmd~d„ZndS)‚z Logging package for Python. Based on PEP 282 and comments thereto in comp.lang.python. Copyright (C) 2001-2019 Vinay Sajip. All Rights Reserved. To use, simply 'import logging' and log away! éN)ÚTemplate)Ú Formatter)*Ú BASIC_FORMATÚBufferingFormatterÚCRITICALÚDEBUGÚERRORÚFATALÚ FileHandlerÚFilterrÚHandlerÚINFOÚ LogRecordÚLoggerÚ LoggerAdapterÚNOTSETÚ NullHandlerÚ StreamHandlerÚWARNÚWARNINGÚ addLevelNameÚ basicConfigÚcaptureWarningsÚcriticalÚdebugÚdisableÚerrorÚ exceptionÚfatalÚ getLevelNameÚ getLoggerÚgetLoggerClassÚinfoÚlogÚ makeLogRecordÚsetLoggerClassÚshutdownÚwarnÚwarningÚgetLogRecordFactoryÚsetLogRecordFactoryÚ lastResortÚraiseExceptionsz&Vinay Sajip Z productionz0.5.1.2z07 February 2010Té2é(ééé rrrr rr)rr rrrr rrcCs4t |¡}|dur|St |¡}|dur,|Sd|S)a´ Return the textual or numeric representation of logging level 'level'. If the level is one of the predefined levels (CRITICAL, ERROR, WARNING, INFO, DEBUG) then you get the corresponding string. If you have associated levels with names using addLevelName then the name you have associated with 'level' is returned. If a numeric value corresponding to one of the defined levels is passed in, the corresponding string representation is returned. If a string representation of the level is passed in, the corresponding numeric value is returned. If no matching numeric or string value is passed in, the string 'Level %s' % level is returned. NzLevel %s)Ú _levelToNameÚgetÚ _nameToLevel)ÚlevelÚresult©r7ú3/usr/local/src/Python-3.9.6/Lib/logging/__init__.pyrws  rcCs.tƒz|t|<|t|<Wtƒntƒ0dS)zy Associate 'levelName' with 'level'. This is used when converting levels to text during message formatting. N)Ú _acquireLockr2r4Ú _releaseLock)r5Z levelNamer7r7r8r’s  rÚ _getframecCs t d¡S)Né)Úsysr;r7r7r7r8Ú ór>cCs0zt‚Wn"ty*t ¡djjYS0dS)z5Return the frame object for the caller's stack frame.éN)Ú Exceptionr=Úexc_infoÚtb_frameÚf_backr7r7r7r8Ú currentframe¢s rEcCsJt|tƒr|}n6t|ƒ|kr:|tvr0td|ƒ‚t|}n td|ƒ‚|S)NzUnknown level: %rz*Level not an integer or a valid string: %r)Ú isinstanceÚintÚstrr4Ú ValueErrorÚ TypeError)r5Úrvr7r7r8Ú _checkLevelÁs     rLcCstr t ¡dS)z€ Acquire the module-level lock for serializing access to shared data. This should be released with _releaseLock(). N)Ú_lockÚacquirer7r7r7r8r9Úsr9cCstr t ¡dS)zK Release the module-level lock acquired by calling _acquireLock(). N)rMÚreleaser7r7r7r8r:ãsr:Úregister_at_forkcCsdS©Nr7©Úinstancer7r7r8Ú_register_at_fork_reinit_lockîsrTcCs(tƒzt |¡Wtƒntƒ0dSrQ)r9Ú_at_fork_reinit_lock_weaksetÚaddr:rRr7r7r8rTös cCstD] }| ¡qt ¡dSrQ)rUÚ_at_fork_reinitrM©Úhandlerr7r7r8Ú!_after_at_fork_child_reinit_locksýs rZ)ÚbeforeÚafter_in_childÚafter_in_parentc@s*eZdZdZd dd„Zdd„Zdd„ZdS) ra A LogRecord instance represents an event being logged. LogRecord instances are created every time something is logged. They contain all the information pertinent to the event being logged. The main information passed in is in msg and args, which are combined using str(msg) % args to create the message field of the record. The record also includes information such as when the record was created, the source line where the logging call was made, and any exception information to be logged. Nc Ks–t ¡} ||_||_|rFt|ƒdkrFt|dtjjƒrF|drF|d}||_t |ƒ|_ ||_ ||_ z&t j |¡|_t j |j¡d|_Wn$tttfy¬||_d|_Yn0||_d|_| |_||_||_| |_| t| ƒd|_|jtd|_t rt! "¡|_#t! $¡j|_%n d|_#d|_%t&s,d|_'nBd|_'t(j) *d¡} | durnz|  +¡j|_'Wnt,ylYn0t-rŒt.t dƒrŒt  /¡|_0nd|_0dS) zK Initialize a logging record with interesting information. érzUnknown moduleNièZ MainProcessÚmultiprocessingÚgetpid)1ÚtimeÚnameÚmsgÚlenrFÚ collectionsÚabcÚMappingÚargsrZ levelnameÚlevelnoÚpathnameÚosÚpathÚbasenameÚfilenameÚsplitextÚmodulerJrIÚAttributeErrorrBÚexc_textÚ stack_infoÚlinenoZfuncNameÚcreatedrGÚmsecsÚ _startTimeZrelativeCreatedÚ logThreadsÚ threadingÚ get_identÚthreadÚcurrent_threadZ threadNameÚlogMultiprocessingZ processNamer=Úmodulesr3Zcurrent_processrAÚ logProcessesÚhasattrr`Úprocess) Úselfrbr5rjrtrcrhrBÚfuncÚsinfoÚkwargsÚctZmpr7r7r8Ú__init__sT"ÿ      zLogRecord.__init__cCsd|j|j|j|j|jfS)Nz!)rbrirjrtrc©r‚r7r7r8Ú__repr__bs  ÿzLogRecord.__repr__cCst|jƒ}|jr||j}|S)z« Return the message for this LogRecord. Return the message for this LogRecord after merging any user-supplied arguments with the message. )rHrcrh)r‚rcr7r7r8Ú getMessagefs  zLogRecord.getMessage)NN)Ú__name__Ú __module__Ú __qualname__Ú__doc__r‡r‰rŠr7r7r7r8rs  ÿ HrcCs|adS)z› Set the factory to be used when instantiating a log record. :param factory: A callable which will be called to instantiate a log record. N©Ú_logRecordFactory)Úfactoryr7r7r8r*wsr*cCstS)zH Return the factory to be used when instantiating a log record. rr7r7r7r8r)sr)c Cs&tddddddddƒ}|j |¡|S)zô Make a LogRecord whose attributes are defined by the specified dictionary, This function is useful for converting a logging event received over a socket connection (which is sent as a dictionary) into a LogRecord instance. NÚrr7)rÚ__dict__Úupdate)ÚdictrKr7r7r8r$ˆs r$c@sNeZdZdZdZdZe dej¡Z dd„Z dd„Z d d „Z d d „Z d d„ZdS)Ú PercentStylez %(message)sz %(asctime)sz %(asctime)z5%\(\w+\)[#0+ -]*(\*|\d+)?(\.(\*|\d+))?[diouxefgcrsa%]cCs|p|j|_dSrQ)Údefault_formatÚ_fmt©r‚Úfmtr7r7r8r‡¢szPercentStyle.__init__cCs|j |j¡dkS)Nr)r˜ÚfindÚasctime_searchrˆr7r7r8ÚusesTime¥szPercentStyle.usesTimecCs*|j |j¡s&td|j|jdfƒ‚dS)z>Validate the input format, ensure it matches the correct stylez"Invalid format '%s' for '%s' stylerN)Úvalidation_patternÚsearchr˜rIr—rˆr7r7r8Úvalidate¨szPercentStyle.validatecCs |j|jSrQ)r˜r“©r‚Úrecordr7r7r8Ú_format­szPercentStyle._formatc CsBz | |¡WSty<}ztd|ƒ‚WYd}~n d}~00dS)Nz(Formatting field not found in record: %s)r£ÚKeyErrorrI)r‚r¢Úer7r7r8Úformat°s zPercentStyle.formatN)r‹rŒrr—Úasctime_formatrœÚreÚcompileÚIržr‡rr r£r¦r7r7r7r8r–›sr–c@s@eZdZdZdZdZe dej¡Z e d¡Z dd„Z dd „Z d S) ÚStrFormatStylez {message}z {asctime}z{asctimezF^(.?[<>=^])?[+ -]?#?0?(\d+|{\w+})?[,_]?(\.(\d+|{\w+}))?[bcdefgnosx%]?$z^(\d+|\w+)(\.\w+|\[[^]]+\])*$cCs|jjfi|j¤ŽSrQ)r˜r¦r“r¡r7r7r8r£¿szStrFormatStyle._formatc CsÀtƒ}zxt |j¡D]f\}}}}|rF|j |¡s|j ¡|jj|_||_dS)aˆ Initialize the formatter with specified format strings. Initialize the formatter either with the specified format string, or a default as described above. Allow for specialized date formatting with the optional datefmt argument. If datefmt is omitted, you get an ISO8601-like (or RFC 3339-like) format. Use a style parameter of '%', '{' or '$' to specify that you want to use one of %-formatting, :meth:`str.format` (``{}``) formatting or :class:`string.Template` formatting in your format string. .. versionchanged:: 3.2 Added the ``style`` parameter. úStyle must be one of: %sú,rN)Ú_STYLESrIÚjoinÚkeysÚ_styler r˜Údatefmt)r‚ršrÌÚstyler r7r7r8r‡)sÿ  zFormatter.__init__z%Y-%m-%d %H:%M:%Sz%s,%03dcCsF| |j¡}|rt ||¡}n$t |j|¡}|jrB|j||jf}|S)a% Return the creation time of the specified LogRecord as formatted text. This method should be called from format() by a formatter which wants to make use of a formatted time. This method can be overridden in formatters to provide for any specific requirement, but the basic behaviour is as follows: if datefmt (a string) is specified, it is used with time.strftime() to format the creation time of the record. Otherwise, an ISO8601-like (or RFC 3339-like) format is used. The resulting string is returned. This function uses a user-configurable function to convert the creation time to a tuple. By default, time.localtime() is used; to change this for a particular formatter instance, set the 'converter' attribute to a function with the same signature as time.localtime() or time.gmtime(). To change it for all formatters, for example if you want all logging times to be shown in GMT, set the 'converter' attribute in the Formatter class. )Ú converterruraÚstrftimeÚdefault_time_formatÚdefault_msec_formatrv)r‚r¢rÌr†Úsr7r7r8Ú formatTimeFs zFormatter.formatTimecCsZt ¡}|d}t |d|d|d|¡| ¡}| ¡|dd…dkrV|dd…}|S)z§ Format and return the specified exception information as a string. This default implementation just uses traceback.print_exception() r@rr^NéÿÿÿÿÚ )ÚioÚStringIOÚ tracebackÚprint_exceptionÚgetvalueÚclose)r‚ZeiÚsioÚtbrÒr7r7r8ÚformatExceptionas zFormatter.formatExceptioncCs |j ¡S)zK Check if the format uses the creation time of the record. )rËrrˆr7r7r8rtszFormatter.usesTimecCs |j |¡SrQ)rËr¦r¡r7r7r8Ú formatMessagezszFormatter.formatMessagecCs|S)aU This method is provided as an extension point for specialized formatting of stack information. The input data is a string as returned from a call to :func:`traceback.print_stack`, but with the last trailing newline removed. The base implementation just returns the value passed in. r7)r‚rsr7r7r8Ú formatStack}s zFormatter.formatStackcCs | ¡|_| ¡r"| ||j¡|_| |¡}|jrF|jsF|  |j¡|_|jrn|dd…dkrd|d}||j}|j rœ|dd…dkrŒ|d}||  |j ¡}|S)az Format the specified record as text. The record's attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message. rÔNrÕ) rŠÚmessagerrÓrÌÚasctimerßrBrrrÞrsrà)r‚r¢rÒr7r7r8r¦Šs   zFormatter.format)NNrÄT)N)r‹rŒrrŽraÚ localtimerÎr‡rÐrÑrÓrÞrrßràr¦r7r7r7r8rüs*   rc@s2eZdZdZd dd„Zdd„Zdd„Zd d „ZdS) rzB A formatter suitable for formatting a number of records. NcCs|r ||_nt|_dS)zm Optionally specify a formatter which will be used to format each individual record. N)ÚlinefmtÚ_defaultFormatter)r‚rär7r7r8r‡³szBufferingFormatter.__init__cCsdS)zE Return the header string for the specified records. r’r7©r‚Úrecordsr7r7r8Ú formatHeader½szBufferingFormatter.formatHeadercCsdS)zE Return the footer string for the specified records. r’r7rær7r7r8Ú formatFooterÃszBufferingFormatter.formatFootercCsJd}t|ƒdkrF|| |¡}|D]}||j |¡}q"|| |¡}|S)zQ Format the specified records and return the result as a string. r’r)rdrèrär¦ré)r‚rçrKr¢r7r7r8r¦És zBufferingFormatter.format)N)r‹rŒrrŽr‡rèrér¦r7r7r7r8r¯s  rc@s"eZdZdZddd„Zdd„ZdS) r aö Filter instances are used to perform arbitrary filtering of LogRecords. Loggers and Handlers can optionally use Filter instances to filter records as desired. The base filter class only allows events which are below a certain point in the logger hierarchy. For example, a filter initialized with "A.B" will allow events logged by loggers "A.B", "A.B.C", "A.B.C.D", "A.B.D" etc. but not "A.BB", "B.A.B" etc. If initialized with the empty string, all events are passed. r’cCs||_t|ƒ|_dS)zæ Initialize a filter. Initialize with the name of the logger which, together with its children, will have its events allowed through the filter. If no name is specified, allow every event. N)rbrdÚnlen©r‚rbr7r7r8r‡äszFilter.__init__cCsJ|jdkrdS|j|jkrdS|j |jd|j¡dkr:dS|j|jdkS)zÒ Determine if the specified record is to be logged. Returns True if the record should be logged, or False otherwise. If deemed appropriate, the record may be modified in-place. rTFÚ.)rêrbr›r¡r7r7r8Úfilterïs  z Filter.filterN)r’)r‹rŒrrŽr‡rír7r7r7r8r Ùs r c@s0eZdZdZdd„Zdd„Zdd„Zdd „Zd S) ÚFiltererz[ A base class for loggers and handlers which allows them to share common code. cCs g|_dS)zE Initialize the list of filters to be an empty list. N)Úfiltersrˆr7r7r8r‡szFilterer.__init__cCs||jvr|j |¡dS)z; Add the specified filter to this handler. N)rïÚappend©r‚rír7r7r8Ú addFilter s zFilterer.addFiltercCs||jvr|j |¡dS)z@ Remove the specified filter from this handler. N)rïÚremoverñr7r7r8Ú removeFilters zFilterer.removeFiltercCs>d}|jD].}t|dƒr$| |¡}n||ƒ}|s d}q:q |S)ah Determine if a record is loggable by consulting all the filters. The default is to allow the record to be logged; any filter can veto this and the record is then dropped. Returns a zero value if a record is to be dropped, else non-zero. .. versionchanged:: 3.2 Allow filters to be just callables. TríF)rïr€rí)r‚r¢rKÚfr6r7r7r8rís    zFilterer.filterN)r‹rŒrrŽr‡ròrôrír7r7r7r8rîþs rîcCsLttt}}}|rH|rH|rH|ƒz||vr6| |¡W|ƒn|ƒ0dS)zD Remove a handler reference from the internal cleanup list. N)r9r:Ú _handlerListró)ÚwrrNrOÚhandlersr7r7r8Ú_removeHandlerRef5s  rùcCs0tƒzt t |t¡¡Wtƒntƒ0dS)zL Add a handler to the internal cleanup list using a weak reference. N)r9rörðÚweakrefÚrefrùr:rXr7r7r8Ú_addHandlerRefFsrüc@sžeZdZdZefdd„Zdd„Zdd„ZeeeƒZ dd „Z d d „Z d d „Z dd„Z dd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zd d!„Zd"S)#r aq Handler instances dispatch logging events to specific destinations. The base handler class. Acts as a placeholder which defines the Handler interface. Handlers can optionally use Formatter instances to format records as desired. By default, no formatter is specified; in this case, the 'raw' message as determined by record.message is logged. cCs4t |¡d|_t|ƒ|_d|_t|ƒ| ¡dS)zz Initializes the instance - basically setting the formatter to None and the filter list to empty. N)rîr‡Ú_namerLr5Ú formatterrüÚ createLock©r‚r5r7r7r8r‡Ys   zHandler.__init__cCs|jSrQ)rýrˆr7r7r8Úget_namefszHandler.get_namecCsBtƒz.|jtvrt|j=||_|r,|t|<Wtƒntƒ0dSrQ©r9rýÚ _handlersr:rër7r7r8Úset_nameis  zHandler.set_namecCst ¡|_t|ƒdS)zU Acquire a thread lock for serializing access to the underlying I/O. N)ryÚRLockÚlockrTrˆr7r7r8rÿvs zHandler.createLockcCs|j ¡dSrQ)rrWrˆr7r7r8rW}szHandler._at_fork_reinitcCs|jr|j ¡dS)z. Acquire the I/O thread lock. N)rrNrˆr7r7r8rN€szHandler.acquirecCs|jr|j ¡dS)z. Release the I/O thread lock. N)rrOrˆr7r7r8rO‡szHandler.releasecCst|ƒ|_dS)zX Set the logging level of this handler. level must be an int or a str. N)rLr5rr7r7r8ÚsetLevelŽszHandler.setLevelcCs|jr|j}nt}| |¡S)z“ Format the specified record. If a formatter is set, use it. Otherwise, use the default formatter for the module. )rþrår¦)r‚r¢ršr7r7r8r¦”szHandler.formatcCs tdƒ‚dS)zà Do whatever it takes to actually log the specified logging record. This version is intended to be implemented by subclasses and so raises a NotImplementedError. z.emit must be implemented by Handler subclassesN)ÚNotImplementedErrorr¡r7r7r8Úemit¡sz Handler.emitcCs<| |¡}|r8| ¡z| |¡W| ¡n | ¡0|S)a< Conditionally emit the specified logging record. Emission depends on filters which may have been added to the handler. Wrap the actual emission of the record with acquisition/release of the I/O thread lock. Returns whether the filter passed the record for emission. )rírNr rO)r‚r¢rKr7r7r8Úhandle«s  zHandler.handlecCs ||_dS)z5 Set the formatter for this handler. N)rþr™r7r7r8Ú setFormatter½szHandler.setFormattercCsdS)z™ Ensure all logging output has been flushed. This version does nothing and is intended to be implemented by subclasses. Nr7rˆr7r7r8ÚflushÃsz Handler.flushcCs6tƒz"|jr |jtvr t|j=Wtƒntƒ0dS)a% Tidy up any resources used by the handler. This version removes the handler from an internal map of handlers, _handlers, which is used for handler lookup by name. Subclasses should ensure that this gets called from overridden close() methods. Nrrˆr7r7r8rÛÌs  z Handler.closecCs trtjrt ¡\}}}zözÖtj d¡t |||dtj¡tj d¡|j}|rvtj   |j j ¡t dkrv|j}qR|rŒtj|tjdntj d|j|jf¡ztj d|j|jf¡Wn0tyÔ‚Yntyðtj d¡Yn0WntyYn0W~~~n~~~0dS) aD Handle errors which occur during an emit() call. This method should be called from handlers when an exception is encountered during an emit() call. If raiseExceptions is false, exceptions get silently ignored. This is what is mostly wanted for a logging system - most users will not care about errors in the logging system, they are more interested in application errors. You could, however, replace this with a custom handler if you wish. The record which was being processed is passed in to this method. z--- Logging error --- Nz Call stack: r©ÚfilezLogged from file %s, line %s zMessage: %r Arguments: %s zwUnable to print the message and arguments - possible formatting error. Use the traceback above to help find the error. )r,r=ÚstderrrBÚwriterØrÙrCrkrlÚdirnameÚf_codeÚ co_filenameÚ__path__rDÚ print_stackrnrtrcrhÚRecursionErrorrAÚOSError)r‚r¢ÚtÚvrÝÚframer7r7r8Ú handleErrorÝs:   ÿÿÿÿ   zHandler.handleErrorcCst|jƒ}d|jj|fS)Nz <%s (%s)>)rr5Ú __class__r‹rr7r7r8r‰ s zHandler.__repr__N)r‹rŒrrŽrr‡rrÚpropertyrbrÿrWrNrOrr¦r r r r rÛrr‰r7r7r7r8r Ps$     /r c@s>eZdZdZdZddd„Zdd„Zdd „Zd d „Zd d „Z dS)rz¾ A handler class which writes logging records, appropriately formatted, to a stream. Note that this class does not close the stream, as sys.stdout or sys.stderr may be used. rÕNcCs"t |¡|durtj}||_dS)zb Initialize the handler. If stream is not specified, sys.stderr is used. N)r r‡r=rÚstream©r‚rr7r7r8r‡s zStreamHandler.__init__cCs@| ¡z(|jr&t|jdƒr&|j ¡W| ¡n | ¡0dS)z% Flushes the stream. r N)rNrr€r rOrˆr7r7r8r $s  zStreamHandler.flushcCs`z,| |¡}|j}| ||j¡| ¡Wn.ty@‚YntyZ| |¡Yn0dS)a« Emit a record. If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline. If exception information is present, it is formatted using traceback.print_exception and appended to the stream. If the stream has an 'encoding' attribute, it is used to determine how to do the output to the stream. N)r¦rrÚ terminatorr rrAr)r‚r¢rcrr7r7r8r /s     zStreamHandler.emitcCsH||jurd}n4|j}| ¡z| ¡||_W| ¡n | ¡0|S)z¿ Sets the StreamHandler's stream to the specified value, if it is different. Returns the old stream, if the stream was changed, or None if it wasn't. N)rrNr rO)r‚rr6r7r7r8Ú setStreamEs zStreamHandler.setStreamcCs>t|jƒ}t|jddƒ}t|ƒ}|r,|d7}d|jj||fS)Nrbr’ú z <%s %s(%s)>)rr5ÚgetattrrrHrr‹)r‚r5rbr7r7r8r‰Ys  zStreamHandler.__repr__)N) r‹rŒrrŽr r‡r r r!r‰r7r7r7r8rs  rc@s:eZdZdZddd„Zdd„Zd d „Zd d „Zd d„ZdS)r zO A handler class which writes formatted logging records to disk files. ÚaNFcCsZt |¡}tj |¡|_||_||_||_||_|rFt   |¡d|_ nt   ||  ¡¡dS)zO Open the specified file and use it as the stream for logging. N)rkÚfspathrlÚabspathÚ baseFilenameÚmodeÚencodingÚerrorsÚdelayr r‡rrÚ_open)r‚rnr(r)r+r*r7r7r8r‡gs  zFileHandler.__init__c Cs’| ¡zzz`|jr^z*| ¡W|j}d|_t|dƒr^| ¡n |j}d|_t|dƒr\| ¡0Wt |¡n t |¡0W| ¡n | ¡0dS)z$ Closes the stream. NrÛ)rNrr r€rÛrrOrr7r7r8rÛ|s    ý  zFileHandler.closecCst|j|j|j|jdS)zx Open the current base file with the (original) mode and encoding. Return the resulting stream. ©r)r*)Úopenr'r(r)r*rˆr7r7r8r,’sÿzFileHandler._opencCs$|jdur| ¡|_t ||¡dS)z® Emit a record. If the stream was not opened because 'delay' was specified in the constructor, open it before calling the superclass's emit. N)rr,rr r¡r7r7r8r šs  zFileHandler.emitcCst|jƒ}d|jj|j|fS©Nz <%s %s (%s)>)rr5rr‹r'rr7r7r8r‰¥s zFileHandler.__repr__)r$NFN) r‹rŒrrŽr‡rÛr,r r‰r7r7r7r8r cs   r c@s(eZdZdZefdd„Zedd„ƒZdS)Ú_StderrHandlerzÀ This class is like a StreamHandler using sys.stderr, but always uses whatever sys.stderr is currently set to rather than the value of sys.stderr at handler construction time. cCst ||¡dS)z) Initialize the handler. N)r r‡rr7r7r8r‡°sz_StderrHandler.__init__cCstjSrQ)r=rrˆr7r7r8r¶sz_StderrHandler.streamN)r‹rŒrrŽrr‡rrr7r7r7r8r0ªs r0c@s eZdZdZdd„Zdd„ZdS)Ú PlaceHolderzã PlaceHolder instances are used in the Manager logger hierarchy to take the place of nodes for which no loggers have been defined. This class is intended for internal use only and not as part of the public API. cCs|di|_dS)zY Initialize with the specified logger being a child of this placeholder. N©Ú loggerMap©r‚Úaloggerr7r7r8r‡ÈszPlaceHolder.__init__cCs||jvrd|j|<dS)zJ Add the specified logger as a child of this placeholder. Nr2r4r7r7r8rðÎs zPlaceHolder.appendN)r‹rŒrrŽr‡rðr7r7r7r8r1Âsr1cCs(|tkr t|tƒs td|jƒ‚|adS)zÇ Set the class to be used when instantiating a logger. The class should define __init__() such that only a name argument is required, and the __init__() should call Logger.__init__() ú(logger not derived from logging.Logger: N)rÚ issubclassrJr‹Ú _loggerClass)Úklassr7r7r8r%Ùs  ÿr%cCstS)zB Return the class to be used when instantiating a logger. )r8r7r7r7r8r!æsr!c@sbeZdZdZdd„Zedd„ƒZejdd„ƒZdd„Zd d „Z d d „Z d d„Z dd„Z dd„Z dS)ÚManagerzt There is [under normal circumstances] just one Manager instance, which holds the hierarchy of loggers. cCs(||_d|_d|_i|_d|_d|_dS)zT Initialize the manager with the root node of the logger hierarchy. rFN)ÚrootrÚemittedNoHandlerWarningÚ loggerDictÚ loggerClassÚlogRecordFactory)r‚Zrootnoder7r7r8r‡ñs zManager.__init__cCs|jSrQ)Ú_disablerˆr7r7r8rüszManager.disablecCst|ƒ|_dSrQ)rLr@©r‚Úvaluer7r7r8rscCs´d}t|tƒstdƒ‚tƒzŠ||jvrv|j|}t|tƒrž|}|jpHt|ƒ}||_||j|<|  ||¡|  |¡n(|jp~t|ƒ}||_||j|<|  |¡Wt ƒnt ƒ0|S)aá Get a logger with the specified name (channel name), creating it if it doesn't yet exist. This name is a dot-separated hierarchical name, such as "a", "a.b", "a.b.c" or similar. If a PlaceHolder existed for the specified name [i.e. the logger didn't exist but a child of it did], replace it with the created logger and fix up the parent/child references which pointed to the placeholder to now point to the logger. NzA logger name must be a string) rFrHrJr9r=r1r>r8ÚmanagerÚ_fixupChildrenÚ _fixupParentsr:)r‚rbrKÚphr7r7r8r s(          zManager.getLoggercCs*|tkr t|tƒs td|jƒ‚||_dS)zY Set the class to be used when instantiating a logger with this Manager. r6N)rr7rJr‹r>)r‚r9r7r7r8r%&s  ÿzManager.setLoggerClasscCs ||_dS)zg Set the factory to be used when instantiating a log record with this Manager. N)r?)r‚r‘r7r7r8r*0szManager.setLogRecordFactorycCs |j}| d¡}d}|dkrŒ|sŒ|d|…}||jvrFt|ƒ|j|<n2|j|}t|tƒr`|}nt|tƒsnJ‚| |¡| dd|d¡}q|s–|j}||_dS)z™ Ensure that there are either loggers or placeholders all the way from the specified logger to the root of the logger hierarchy. rìNrr^) rbÚrfindr=r1rFrrðr;Úparent)r‚r5rbÚirKZsubstrÚobjr7r7r8rE7s        zManager._fixupParentscCsD|j}t|ƒ}|j ¡D]&}|jjd|…|kr|j|_||_qdS)zk Ensure that children of the placeholder ph are connected to the specified logger. N)rbrdr3rÊrH)r‚rFr5rbZnamelenÚcr7r7r8rDOs zManager._fixupChildrencCs@tƒ|j ¡D]}t|tƒr|j ¡q|jj ¡tƒdS)zj Clear the cache for all loggers in loggerDict Called when level changes are made N) r9r=ÚvaluesrFrÚ_cacheÚclearr;r:©r‚Úloggerr7r7r8Ú _clear_cache\s    zManager._clear_cacheN)r‹rŒrrŽr‡rrÚsetterr r%r*rErDrQr7r7r7r8r:ìs   "  r:c@sÜeZdZdZefdd„Zdd„Zdd„Zdd „Zd d „Z d d „Z dd„Z ddœdd„Z dd„Z e Zdd„Zd5dd„Zd6dd„Zd7dd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„Zd-d.„Zd/d0„Zd1d2„Zd3d4„ZdS)8rar Instances of the Logger class represent a single logging channel. A "logging channel" indicates an area of an application. Exactly how an "area" is defined is up to the application developer. Since an application can have any number of areas, logging channels are identified by a unique string. Application areas can be nested (e.g. an area of "input processing" might include sub-areas "read CSV files", "read XLS files" and "read Gnumeric files"). To cater for this natural nesting, channel names are organized into a namespace hierarchy where levels are separated by periods, much like the Java or Python package namespace. So in the instance given above, channel names might be "input" for the upper level, and "input.csv", "input.xls" and "input.gnu" for the sub-levels. There is no arbitrary limit to the depth of nesting. cCs<t |¡||_t|ƒ|_d|_d|_g|_d|_i|_ dS)zJ Initialize the logger with a name and an optional level. NTF) rîr‡rbrLr5rHÚ propagaterøÚdisabledrM)r‚rbr5r7r7r8r‡|s  zLogger.__init__cCst|ƒ|_|j ¡dS)zW Set the logging level of this logger. level must be an int or a str. N)rLr5rCrQrr7r7r8r‰s zLogger.setLevelcOs$| t¡r |jt||fi|¤ŽdS)zð Log 'msg % args' with severity 'DEBUG'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.debug("Houston, we have a %s", "thorny problem", exc_info=1) N)Ú isEnabledForrÚ_log©r‚rcrhr…r7r7r8rs z Logger.debugcOs$| t¡r |jt||fi|¤ŽdS)zó Log 'msg % args' with severity 'INFO'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.info("Houston, we have a %s", "interesting problem", exc_info=1) N)rUr rVrWr7r7r8r"œs z Logger.infocOs$| t¡r |jt||fi|¤ŽdS)zö Log 'msg % args' with severity 'WARNING'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.warning("Houston, we have a %s", "bit of a problem", exc_info=1) N)rUrrVrWr7r7r8r(¨s zLogger.warningcOs*t dtd¡|j|g|¢Ri|¤ŽdS©Nz6The 'warn' method is deprecated, use 'warning' insteadr@©Úwarningsr'ÚDeprecationWarningr(rWr7r7r8r'´sÿz Logger.warncOs$| t¡r |jt||fi|¤ŽdS)zï Log 'msg % args' with severity 'ERROR'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.error("Houston, we have a %s", "major problem", exc_info=1) N)rUrrVrWr7r7r8r¹s z Logger.errorT©rBcOs |j|g|¢Rd|i|¤ŽdS)zU Convenience method for logging an ERROR with exception information. rBN©r©r‚rcrBrhr…r7r7r8rÅszLogger.exceptioncOs$| t¡r |jt||fi|¤ŽdS)zö Log 'msg % args' with severity 'CRITICAL'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.critical("Houston, we have a %s", "major disaster", exc_info=1) N)rUrrVrWr7r7r8rËs zLogger.criticalcOs@t|tƒstrtdƒ‚ndS| |¡r<|j|||fi|¤ŽdS)zü Log 'msg % args' with the integer severity 'level'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.log(level, "We have a %s", "mysterious problem", exc_info=1) zlevel must be an integerN)rFrGr,rJrUrV©r‚r5rcrhr…r7r7r8r#Ùs   z Logger.logFr^c CsØtƒ}|dur|j}|}|r4|dkr4|j}|d8}q|s<|}d}t|dƒrÔ|j}tj |j¡}|tkrn|j}q@d}|r¾t   ¡} |   d¡t j || d|  ¡}|ddkr¶|dd…}|  ¡|j|j|j|f}qÔq@|S) z… Find the stack frame of the caller so that we can note the source file name, line number and function name. Nr^)ú(unknown file)rú(unknown function)NrzStack (most recent call last): r rÔrÕ)rErDr€rrkrlÚnormcaserÚ_srcfilerÖr×rrØrrÚrÛÚf_linenoÚco_name) r‚rsÚ stacklevelrõZorig_frKÚcornr„rÜr7r7r8Ú findCallerês8      zLogger.findCallerNc CsZt||||||||| ƒ } | durV| D]0} | dvs:| | jvrFtd| ƒ‚| | | j| <q$| S)zr A factory method which can be overridden in subclasses to create specialized LogRecords. N)rárâz$Attempt to overwrite %r in LogRecord)rr“r¤) r‚rbr5ÚfnÚlnorcrhrBrƒÚextrar„rKÚkeyr7r7r8Ú makeRecordsÿ zLogger.makeRecordc Cs¨d}tr@z| ||¡\} } } }WqJty<d\} } } YqJ0n d\} } } |r|t|tƒrjt|ƒ||jf}nt|tƒs|t  ¡}|  |j || | |||| ||¡ } |  | ¡dS)z’ Low-level logging routine which creates a LogRecord and then calls all the handlers of this logger to handle the record. N)r`rra) rcrhrIrFÚ BaseExceptionÚtypeÚ __traceback__Útupler=rBrmrbr ) r‚r5rcrhrBrkrsrfr„rirjrƒr¢r7r7r8rVs     ÿz Logger._logcCs|js| |¡r| |¡dS)zÕ Call the handlers for the specified record. This method is used for unpickled records received from a socket, as well as those created locally. Logger-level filtering is applied. N)rTríÚ callHandlersr¡r7r7r8r 7sz Logger.handlecCs4tƒz ||jvr|j |¡Wtƒntƒ0dS)z; Add the specified handler to this logger. N)r9rørðr:©r‚Úhdlrr7r7r8Ú addHandlerAs  zLogger.addHandlercCs4tƒz ||jvr|j |¡Wtƒntƒ0dS)z@ Remove the specified handler from this logger. N)r9rørór:rsr7r7r8Ú removeHandlerLs  zLogger.removeHandlercCs.|}d}|r*|jrd}q*|js"q*q|j}q|S)a¢ See if this logger has any handlers configured. Loop through all handlers for this logger and its parents in the logger hierarchy. Return True if a handler was found, else False. Stop searching up the hierarchy whenever a logger with the "propagate" attribute set to zero is found - that will be the last logger which is checked for the existence of handlers. FT)rørSrH)r‚rKrKr7r7r8Ú hasHandlersWs zLogger.hasHandlerscCs˜|}d}|rJ|jD]"}|d}|j|jkr| |¡q|jsBd}q|j}q|dkr”trn|jtjkr”t |¡n&tr”|jj s”t j   d|j ¡d|j_ dS)aœ Pass a record to all relevant handlers. Loop through all handlers for this logger and its parents in the logger hierarchy. If no handler was found, output a one-off error message to sys.stderr. Stop searching up the hierarchy whenever a logger with the "propagate" attribute set to zero is found - that will be the last logger whose handlers are called. rr^Nz+No handlers could be found for logger "%s" T)rørir5r rSrHr+r,rCr<r=rrrb)r‚r¢rKÚfoundrtr7r7r8rrms&       ÿzLogger.callHandlerscCs |}|r|jr|jS|j}qtS)zÏ Get the effective level for this logger. Loop through this logger and its parents in the logger hierarchy, looking for a non-zero logging level. Return the first one found. )r5rHrrOr7r7r8ÚgetEffectiveLevel‹s zLogger.getEffectiveLevelc Cs~|jr dSz |j|WStyxtƒz<|jj|krHd}|j|<n|| ¡k}|j|<Wtƒntƒ0|YS0dS)ú; Is this logger enabled for level 'level'? FN)rTrMr¤r9rCrryr:)r‚r5Z is_enabledr7r7r8rU™s    ÿzLogger.isEnabledForcCs&|j|urd |j|f¡}|j |¡S)ab Get a logger which is a descendant to this one. This is a convenience method, such that logging.getLogger('abc').getChild('def.ghi') is the same as logging.getLogger('abc.def.ghi') It's useful, for example, when the parent logger is named using __name__ rather than a literal string. rì)r;rÉrbrCr )r‚Úsuffixr7r7r8ÚgetChild¯s zLogger.getChildcCs t| ¡ƒ}d|jj|j|fSr/)rryrr‹rbrr7r7r8r‰Âs zLogger.__repr__cCs,t|jƒ|ur ddl}| d¡‚t|jffS)Nrzlogger cannot be pickled)r rbÚpickleÚ PicklingError)r‚r}r7r7r8Ú __reduce__Æs zLogger.__reduce__)Fr^)NNN)NNFr^)r‹rŒrrŽrr‡rrr"r(r'rrrrr#rhrmrVr rurvrwrrryrUr|r‰rr7r7r7r8rms8       %ÿ ÿ    rc@s eZdZdZdd„Zdd„ZdS)Ú RootLoggerzª A root logger is not that different to any other logger, except that it must have a logging level and there is only one instance of it in the hierarchy. cCst |d|¡dS)z= Initialize the logger with the name "root". r;N)rr‡rr7r7r8r‡ÕszRootLogger.__init__cCstdfS)Nr7)r rˆr7r7r8rÛszRootLogger.__reduce__N)r‹rŒrrŽr‡rr7r7r7r8r€Ïsr€c@s¾eZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dd„Z ddœdd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zd+d"d#„Zed$d%„ƒZejd&d%„ƒZed'd(„ƒZd)d*„Zd S),rzo An adapter for loggers which makes it easier to specify contextual information in logging output. cCs||_||_dS)ax Initialize the adapter with a logger and a dict-like object which provides contextual information. This constructor signature allows easy stacking of LoggerAdapters, if so desired. You can effectively pass keyword arguments as shown in the following example: adapter = LoggerAdapter(someLogger, dict(p1=v1, p2="v2")) N)rPrk)r‚rPrkr7r7r8r‡æs zLoggerAdapter.__init__cCs|j|d<||fS)a¢ Process the logging message and keyword arguments passed in to a logging call to insert contextual information. You can either manipulate the message itself, the keyword args or both. Return the message and kwargs modified (or not) to suit your needs. Normally, you'll only need to override this one method in a LoggerAdapter subclass for your specific needs. rk)rk)r‚rcr…r7r7r8rôs zLoggerAdapter.processcOs|jt|g|¢Ri|¤ŽdS)zA Delegate a debug call to the underlying logger. N)r#rrWr7r7r8rszLoggerAdapter.debugcOs|jt|g|¢Ri|¤ŽdS)zA Delegate an info call to the underlying logger. N)r#r rWr7r7r8r" szLoggerAdapter.infocOs|jt|g|¢Ri|¤ŽdS)zC Delegate a warning call to the underlying logger. N)r#rrWr7r7r8r(szLoggerAdapter.warningcOs*t dtd¡|j|g|¢Ri|¤ŽdSrXrYrWr7r7r8r'sÿzLoggerAdapter.warncOs|jt|g|¢Ri|¤ŽdS)zB Delegate an error call to the underlying logger. N©r#rrWr7r7r8rszLoggerAdapter.errorTr\cOs"|jt|g|¢Rd|i|¤ŽdS)zF Delegate an exception call to the underlying logger. rBNrr^r7r7r8r!szLoggerAdapter.exceptioncOs|jt|g|¢Ri|¤ŽdS)zD Delegate a critical call to the underlying logger. N)r#rrWr7r7r8r'szLoggerAdapter.criticalcOs:| |¡r6| ||¡\}}|jj||g|¢Ri|¤ŽdS)z‡ Delegate a log call to the underlying logger, after adding contextual information from this adapter instance. N)rUrrPr#r_r7r7r8r#-s zLoggerAdapter.logcCs |j |¡S)rz)rPrUrr7r7r8rU6szLoggerAdapter.isEnabledForcCs|j |¡dS)zC Set the specified level on the underlying logger. N)rPrrr7r7r8r<szLoggerAdapter.setLevelcCs |j ¡S)zD Get the effective level for the underlying logger. )rPryrˆr7r7r8ryBszLoggerAdapter.getEffectiveLevelcCs |j ¡S)z@ See if the underlying logger has any handlers. )rPrwrˆr7r7r8rwHszLoggerAdapter.hasHandlersNFcCs|jj||||||dS)zX Low-level log implementation, proxied to allow nested logger adapters. )rBrkrs)rPrV)r‚r5rcrhrBrkrsr7r7r8rVNsúzLoggerAdapter._logcCs|jjSrQ©rPrCrˆr7r7r8rC[szLoggerAdapter.managercCs ||j_dSrQr‚rAr7r7r8rC_scCs|jjSrQ)rPrbrˆr7r7r8rbcszLoggerAdapter.namecCs&|j}t| ¡ƒ}d|jj|j|fSr/)rPrryrr‹rb)r‚rPr5r7r7r8r‰gs zLoggerAdapter.__repr__)NNF)r‹rŒrrŽr‡rrr"r(r'rrrr#rUrryrwrVrrCrRrbr‰r7r7r7r8ràs.     rcKsætƒzÐ| dd¡}| dd¡}| dd¡}|rXtjdd…D]}t |¡| ¡q@ttjƒdkrÐ| dd¡}|dur–d |vr®d |vr®td ƒ‚nd |vs¦d |vr®td ƒ‚|dur | d d¡}| d d¡}|ròd|vràd}t||||d}n| d d¡}t |ƒ}|g}| dd¡} | dd¡} | t vrDtdd  t   ¡¡ƒ‚| dt | d¡} t | | | ƒ} |D]&}|jdur‚| | ¡t |¡qh| dd¡} | dur°t | ¡|rÐd  |  ¡¡}td|ƒ‚Wtƒntƒ0dS)a9 Do basic configuration for the logging system. This function does nothing if the root logger already has handlers configured, unless the keyword argument *force* is set to ``True``. It is a convenience method intended for use by simple scripts to do one-shot configuration of the logging package. The default behaviour is to create a StreamHandler which writes to sys.stderr, set a formatter using the BASIC_FORMAT format string, and add the handler to the root logger. A number of optional keyword arguments may be specified, which can alter the default behaviour. filename Specifies that a FileHandler be created, using the specified filename, rather than a StreamHandler. filemode Specifies the mode to open the file, if filename is specified (if filemode is unspecified, it defaults to 'a'). format Use the specified format string for the handler. datefmt Use the specified date/time format. style If a format string is specified, use this to specify the type of format string (possible values '%', '{', '$', for %-formatting, :meth:`str.format` and :class:`string.Template` - defaults to '%'). level Set the root logger level to the specified level. stream Use the specified stream to initialize the StreamHandler. Note that this argument is incompatible with 'filename' - if both are present, 'stream' is ignored. handlers If specified, this should be an iterable of already created handlers, which will be added to the root handler. Any handler in the list which does not have a formatter assigned will be assigned the formatter created in this function. force If this keyword is specified as true, any existing handlers attached to the root logger are removed and closed, before carrying out the configuration as specified by the other arguments. encoding If specified together with a filename, this encoding is passed to the created FileHandler, causing it to be used when the file is opened. errors If specified together with a filename, this value is passed to the created FileHandler, causing it to be used when the file is opened in text mode. If not specified, the default value is `backslashreplace`. Note that you could specify a stream created using open(filename, mode) rather than passing the filename and mode in. However, it should be remembered that StreamHandler does not close its stream (since it may be using sys.stdout or sys.stderr), whereas FileHandler closes its stream when the handler is closed. .. versionchanged:: 3.2 Added the ``style`` parameter. .. versionchanged:: 3.3 Added the ``handlers`` parameter. A ``ValueError`` is now thrown for incompatible arguments (e.g. ``handlers`` specified together with ``filename``/``filemode``, or ``filename``/``filemode`` specified together with ``stream``, or ``handlers`` specified together with ``stream``. .. versionchanged:: 3.8 Added the ``force`` parameter. .. versionchanged:: 3.9 Added the ``encoding`` and ``errors`` parameters. ÚforceFr)Nr*Úbackslashreplacerrørrnz8'stream' and 'filename' should not be specified togetherzG'stream' or 'filename' should not be specified together with 'handlers'Úfilemoder$Úbr-rÌrÍrÄrÆrÇr¦r^r5z, zUnrecognised argument(s): %s)r9Úpopr;rørvrÛrdrIr rrÈrÉrÊrrþr rurr:)r…rƒr)r*Úhrørnr(rZdfsrÍÚfsršr5rÊr7r7r8rts^F          ÿ    ÿ      rcCs(|rt|tƒr|tjkrtStj |¡S)z‚ Return a logger with the specified name, creating it if necessary. If no name is specified, return the root logger. )rFrHr;rbrrCr )rbr7r7r8r òsr cOs0ttjƒdkrtƒtj|g|¢Ri|¤ŽdS)z² Log a message with severity 'CRITICAL' on the root logger. If the logger has no handlers, call basicConfig() to add a console handler with a pre-defined format. rN)rdr;rørr©rcrhr…r7r7r8rüsrcOs0ttjƒdkrtƒtj|g|¢Ri|¤ŽdS)z¯ Log a message with severity 'ERROR' on the root logger. If the logger has no handlers, call basicConfig() to add a console handler with a pre-defined format. rN)rdr;rørrrŠr7r7r8rsrr\cOst|g|¢Rd|i|¤ŽdS)zÐ Log a message with severity 'ERROR' on the root logger, with exception information. If the logger has no handlers, basicConfig() is called to add a console handler with a pre-defined format. rBNr])rcrBrhr…r7r7r8rsrcOs0ttjƒdkrtƒtj|g|¢Ri|¤ŽdS)z± Log a message with severity 'WARNING' on the root logger. If the logger has no handlers, call basicConfig() to add a console handler with a pre-defined format. rN)rdr;rørr(rŠr7r7r8r(sr(cOs(t dtd¡t|g|¢Ri|¤ŽdS)Nz8The 'warn' function is deprecated, use 'warning' insteadr@rYrŠr7r7r8r'$sÿr'cOs0ttjƒdkrtƒtj|g|¢Ri|¤ŽdS)z® Log a message with severity 'INFO' on the root logger. If the logger has no handlers, call basicConfig() to add a console handler with a pre-defined format. rN)rdr;rørr"rŠr7r7r8r")sr"cOs0ttjƒdkrtƒtj|g|¢Ri|¤ŽdS)z¯ Log a message with severity 'DEBUG' on the root logger. If the logger has no handlers, call basicConfig() to add a console handler with a pre-defined format. rN)rdr;rørrrŠr7r7r8r3srcOs2ttjƒdkrtƒtj||g|¢Ri|¤ŽdS)z¾ Log 'msg % args' with the integer severity 'level' on the root logger. If the logger has no handlers, call basicConfig() to add a console handler with a pre-defined format. rN)rdr;rørr#)r5rcrhr…r7r7r8r#=sr#cCs|tj_tj ¡dS)zB Disable all logging calls of severity 'level' and below. N)r;rCrrQ)r5r7r7r8rGsrc Csˆt|dd…ƒD]r}zZ|ƒ}|rlz@z| ¡| ¡| ¡WnttfyTYn0W| ¡n | ¡0Wqtr|‚Yq0qdS)zƒ Perform any cleanup actions in the logging system (e.g. flushing buffers). Should be called at application exit. N)ÚreversedrNr rÛrrIrOr,)Z handlerListr÷rˆr7r7r8r&Ns r&c@s0eZdZdZdd„Zdd„Zdd„Zdd „Zd S) raÙ This handler does nothing. It's intended to be used to avoid the "No handlers could be found for logger XXX" one-off warning. This is important for library code, which may contain code to log events. If a user of the library does not configure logging, the one-off warning might be produced; to avoid this, the library developer simply needs to instantiate a NullHandler and add it to the top-level logger of the library module or package. cCsdS©zStub.Nr7r¡r7r7r8r |szNullHandler.handlecCsdSrŒr7r¡r7r7r8r szNullHandler.emitcCs d|_dSrQ)rrˆr7r7r8rÿ‚szNullHandler.createLockcCsdSrQr7rˆr7r7r8rW…szNullHandler._at_fork_reinitN)r‹rŒrrŽr r rÿrWr7r7r7r8rrs  rcCs`|dur$tdur\t||||||ƒn8t |||||¡}tdƒ}|jsP| tƒ¡| d|¡dS)aˆ Implementation of showwarnings which redirects to logging, which will first check to see if the file parameter is None. If a file is specified, it will delegate to the original warnings implementation of showwarning. Otherwise, it will call warnings.formatwarning and will log the resulting string to a warnings logger named "py.warnings" with level logging.WARNING. Nz py.warningsz%s)Ú_warnings_showwarningrZÚ formatwarningr rørurr()ráÚcategoryrnrtrÚlinerÒrPr7r7r8Ú _showwarningŒs r‘cCs0|rtdur,tjatt_ntdur,tt_dadS)z¿ If capture is true, redirect all warnings to the logging package. If capture is False, ensure that warnings are not redirected to logging but to their original destinations. N)rrZÚ showwarningr‘)Zcapturer7r7r8ržsr)N)NN)orŽr=rkrarÖr¨rØrZrúÚcollections.abcreÚstringrrZ StrFormatterÚ__all__ryÚ __author__Z __status__Ú __version__Z__date__rwr,rxr}rrr rrrr rrr2r4rrr€rErlrbÚ__code__rrcrLrrMr9r:rTÚWeakSetrUrZrPÚobjectrrr*r)r$r®r–r«r¸rrÈrårr rîÚWeakValueDictionaryrrörùrür rr r0Z_defaultLastResortr+r1r%r!r:rr€r8rr;rCrr rrrrr(r'r"rr#rr&ÚatexitÚregisterrrr‘rr7r7r7r8Úsö H     ú ø       þ g ý2*%4 ASG d  ~