QfE ~dZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl mZddl mZgdZddlZdZdZd Zd ZejZd Zd Zd Zd Zd Zd ZeZd ZdZ e Z!dZ"dZ#dZ$edede de"de#de$diZ%eeee e e"e#e$dZ&dZ'dZ(dZ)e*edrdZ+ndZ+ejXj[e)j\j^Z0dZ1dZ2ejfZ4d Z5d!Z6e*ed"sd#Z7n,ejpZ9d$Z7d%Z:ejve5e:e6&Gd'd(e<Z=e=a>d)Z?d*Z@d+ZAeZB[Gd,d-e<ZCGd.d/eCZDGd0d1eCZEd2ZFeCeFfeDd3feEd4fd5ZGGd6d7e<ZeZHGd8d9e<ZIGd:d;e<ZJGd<d=e<ZKejZMgZNd>ZOd?ZPd@ZQdAZRGdBdCeKZSGdDdEeSZTGdFdGeTZUGdHdIeTZVeVe ZWeWZXGdJdKe<ZYdLZZdMZ[GdNdOe<Z\GdPdQeKZ]GdRdSe]Z^e]a_GdTdUe<Z`e^e Zaeae]_ae\e]je]_bdVZcdhdWZddXZedYZfdZZgd d[d\Zhd]Zid^Zjd_Zkd`ZldaZmefdbZneNfdcZoddlpZpepjeoGdddeeSZrdasdidfZtdgZuy)jz Logging package for Python. Based on PEP 282 and comments thereto in comp.lang.python. Copyright (C) 2001-2022 Vinay Sajip. All Rights Reserved. To use, simply 'import logging' and log away! N) GenericAlias)Template) Formatter)- BASIC_FORMATBufferingFormatterCRITICALDEBUGERRORFATAL FileHandlerFilterrHandlerINFO LogRecordLogger LoggerAdapterNOTSET NullHandler StreamHandlerWARNWARNING addLevelName basicConfigcaptureWarningscriticaldebugdisableerror exceptionfatal getLevelName getLoggergetLoggerClassinfolog makeLogRecordsetLoggerClassshutdownwarnwarninggetLogRecordFactorysetLogRecordFactory lastResortraiseExceptionsgetLevelNamesMappinggetHandlerByNamegetHandlerNamesz&Vinay Sajip productionz0.5.1.2z07 February 2010T2( rr rrr r)rr r rrrr rc*tjSN) _nameToLevelcopy7/opt/alt/python312/lib64/python3.12/logging/__init__.pyr/r/~s    r=cptj|}||Stj|}||Sd|zS)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. zLevel %s) _levelToNamegetr:)levelresults r>r!r!sE&  e $F    e $F   r=cpt |t|<|t|<ty#twxYw)zy Associate 'levelName' with 'level'. This is used when converting levels to text during message formatting. N) _acquireLockr@r: _releaseLock)rB levelNames r>rrs- N' U"' Y s) 5 _getframec,tjdS)N)sysrHr<r=r>rLs 3==+r=c| t#t$r*}|jjjcYd}~Sd}~wwxYw)z5Return the frame object for the caller's stack frame.N) Exception __traceback__tb_framef_back)excs r> currentframerSs4 5O 5$$--44 4 5s ;6;;ctjj|jj}|t k(xs d|vxrd|vS)zASignal whether the frame is a CPython or logging module internal. importlib _bootstrap)ospathnormcasef_code co_filename_srcfile)framefilenames r>_is_internal_framer_sDww 8 89H x  x _checkLevelrgsg%  I Uu   $0589 9 %  I #$ $r=c:trtjyy)z Acquire the module-level lock for serializing access to shared data. This should be released with _releaseLock(). N)_lockacquirer<r=r>rErEs    r=c:trtjyy)zK Release the module-level lock acquired by calling _acquireLock(). N)rireleaser<r=r>rFrFs   r=register_at_forkcyr9r<instances r>_register_at_fork_reinit_lockrq r=cvt tj|ty#twxYwr9)rE_at_fork_reinit_lock_weaksetaddrFros r>rqrqs%  ( , ,X 6 NLNs, 8cbtD]}|jtjyr9)rt_at_fork_reinitrihandlers r>!_after_at_fork_child_reinit_locksrz s&3G  # # %4 r=)beforeafter_in_childafter_in_parentc&eZdZdZ ddZdZdZy)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  tj} ||_||_|r?t|dk(r1t |dt j jr |dr|d}||_t||_ ||_ ||_ tjj||_tjj#|j d|_||_d|_| |_||_||_| |_t9| t9| z dzdz|_|j6t<z dz|_t@r=tCjD|_#tCjHj|_%nd|_#d|_%tLsd|_'nHd|_'tPjRjUd} | | jWj|_'tZr*t]td rtj^|_0nd|_0d|_1tdrGtPjRjUd } | r% | jgji|_1yyy#t&t(t*f$r||_d|_YwxYw#tX$rYwxYw#tX$rYywxYw) zK Initialize a logging record with interesting information. rJrzUnknown moduleNig MainProcessmultiprocessinggetpidasyncio)5timenamemsglenra collectionsabcMappingargsr! levelnamelevelnopathnamerWrXbasenamer^splitextmodulererdAttributeErrorexc_infoexc_text stack_infolinenofuncNamecreatedrbmsecs _startTimerelativeCreated logThreads threading get_identthreadcurrent_thread threadNamelogMultiprocessing processNamerKmodulesrAcurrent_processrN logProcesseshasattrrprocesstaskNamelogAsyncioTasks current_taskget_name)selfrrBrrrrrfuncsinfokwargsctmprs r>__init__zLogRecord.__init__*sB YY[ & SY!^ 47KOO)rrrrrrs r>__repr__zLogRecord.__repr__{s,48IIt|| MM4;;2 2r=cft|j}|jr||jz}|S)z Return the message for this LogRecord. Return the message for this LogRecord after merging any user-supplied arguments with the message. )rcrr)rrs r> getMessagezLogRecord.getMessages*$((m 99 /C r=NN)__name__ __module__ __qualname____doc__rrrr<r=r>rrs 8<Ob2 r=rc|ay)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)factorys r>r,r,s  r=ctS)zH Return the factory to be used when instantiating a log record. rr<r=r>r+r+s r=c `tdddddddd}|jj||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. Nrr<)r__dict__update)dictrfs r>r&r&s3 4r1b"dD ABKKt Ir=cveZdZdZdZdZejdejZ dddZ dZ d Z d Z d Zy) PercentStylez %(message)sz %(asctime)sz %(asctime)z5%\(\w+\)[#0+ -]*(\*|\d+)?(\.(\*|\d+))?[diouxefgcrsa%]Ndefaultsc<|xs |j|_||_yr9)default_format_fmt _defaults)rfmtrs r>rzPercentStyle.__init__s.4.. !r=cR|jj|jdk\S)Nrrfindasctime_searchrs r>usesTimezPercentStyle.usesTimes yy~~d112a77r=c|jj|js)td|jd|jddy)z>Validate the input format, ensure it matches the correct stylezInvalid format 'z' for 'rz' styleN)validation_patternsearchrrdrrs r>validatezPercentStyle.validates@&&--dii8TYYPTPcPcdePfgh h9r=ct|jx}r||jz}n |j}|j|zSr9)rrrrrecordrvaluess r>_formatzPercentStyle._formats7~~ %8 %/F__Fyy6!!r=cd |j|S#t$r}td|zd}~wwxYw)Nz(Formatting field not found in record: %s)rKeyErrorrd)rres r>formatzPercentStyle.formats: M<<' ' MG!KL L Ms /*/)rrrrasctime_formatrrecompileIrrrrrrr<r=r>rrsJ"N"N!N#$\^`^b^bc(,"8i "Mr=rceZdZdZdZdZejdejZ ejdZ dZ dZ y) StrFormatStylez {message}z {asctime}z{asctimezF^(.?[<>=^])?[+ -]?#?0?(\d+|{\w+})?[,_]?(\.(\d+|{\w+}))?[bcdefgnosx%]?$z^(\d+|\w+)(\.\w+|\[[^]]+\])*$c|jx}r||jz}n |j}|jjdi|SNr<)rrrrrs r>rzStrFormatStyle._formatsB~~ %8 %/F__Ftyy)&))r=ct} tj|jD]\}}}}|r:|jj |st d|z|j||r|dvrt d|z|s[|jj |rwt d|z |s t dy#t $r}t d|zd}~wwxYw)zKValidate the input format, ensure it is the correct string formatting stylez!invalid field name/expression: %rrsazinvalid conversion: %rzbad specifier: %rzinvalid format: %sNinvalid format: no fields) set_str_formatterparser field_specmatchrdrufmt_spec)rfields_ fieldnamespec conversionrs r>rzStrFormatStyle.validates 72@2F2Ftyy2Q.9dJ??00;()Ly)XYYJJy)*E"9$%= %JKK 3 3D 9$%84%?@@3R89 9 71A56 6 7s$A9CC"C C CCN) rrrrrrrrrrrrrr<r=r>rrsF N NNrzzcegeieijH<=J*:r=rc<eZdZdZdZdZfdZdZdZdZ xZ S)StringTemplateStylez ${message}z ${asctime}cXt||i|t|j|_yr9)superrrr_tpl)rrr __class__s r>rzStringTemplateStyle.__init__s% $)&)TYY' r=c|j}|jddk\xs|j|jdk\S)Nz$asctimerrrrs r>rzStringTemplateStyle.usesTimes8iixx #q(NCHHT5H5H,IQ,NNr=cXtj}t}|j|jD]e}|j }|dr|j |d-|dr|j |dG|jddk(s\td|s tdy)Nnamedbracedr$z$invalid format: bare '$' not allowedr) rpatternrfinditerr groupdictrugrouprd)rrrmds r>rzStringTemplateStyle.validates""!!$)),A Az 1W:&8 1X;'s" !IJJ-89 9r=c|jx}r||jz}n |j}|jjdi|Sr)rrr substituters r>rzStringTemplateStyle._formatsB~~ %8 %/F__F#tyy##-f--r=) rrrrrrrrrr __classcell__)rs@r>rrs'!N!N!N(O :.r=rz"%(levelname)s:%(name)s:%(message)sz{levelname}:{name}:{message}z${levelname}:${name}:${message})%{rcdeZdZdZej Zd dddZdZdZ ddZ dZ d Z d Z d Zd Zy)ra Formatter instances are used to convert a LogRecord to text. Formatters need to know how a LogRecord is constructed. They are responsible for converting a LogRecord to (usually) a string which can be interpreted by either a human or an external system. The base Formatter allows a formatting string to be specified. If none is supplied, the style-dependent default value, "%(message)s", "{message}", or "${message}", is used. The Formatter can be initialized with a format string which makes use of knowledge of the LogRecord attributes - e.g. the default value mentioned above makes use of the fact that the user's message and arguments are pre- formatted into a LogRecord's message attribute. Currently, the useful attributes in a LogRecord are described by: %(name)s Name of the logger (logging channel) %(levelno)s Numeric logging level for the message (DEBUG, INFO, WARNING, ERROR, CRITICAL) %(levelname)s Text logging level for the message ("DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL") %(pathname)s Full pathname of the source file where the logging call was issued (if available) %(filename)s Filename portion of pathname %(module)s Module (name portion of filename) %(lineno)d Source line number where the logging call was issued (if available) %(funcName)s Function name %(created)f Time when the LogRecord was created (time.time() return value) %(asctime)s Textual time when the LogRecord was created %(msecs)d Millisecond portion of the creation time %(relativeCreated)d Time in milliseconds when the LogRecord was created, relative to the time the logging module was loaded (typically at application startup time) %(thread)d Thread ID (if available) %(threadName)s Thread name (if available) %(taskName)s Task name (if available) %(process)d Process ID (if available) %(message)s The result of record.getMessage(), computed just as the record is emitted Nrc|tvr/tddjtjzt|d|||_|r|jj |jj |_||_y)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,rrN)_STYLESrdjoinkeys_stylerrdatefmt)rrrstylerrs r>rzFormatter.__init__Psw"  7#(($\\^;--. .enQ'h?  KK "KK$$  r=z%Y-%m-%d %H:%M:%Sz%s,%03dc|j|j}|rtj||}|Stj|j|}|j r|j ||j fz}|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. ) converterrrstrftimedefault_time_formatdefault_msec_formatr)rrrrss r> formatTimezFormatter.formatTimenso$^^FNN +  gr*A  d66;A'',,6<formatExceptionzFormatter.formatExceptionsikkm U !!"Q%AD#> LLN RS6T>#2Ar=c6|jjS)zK Check if the format uses the creation time of the record. )rrrs r>rzFormatter.usesTimes{{##%%r=c8|jj|Sr9)rrrrs r> formatMessagezFormatter.formatMessages{{!!&))r=c|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. r<)rrs r> formatStackzFormatter.formatStacks r=c|j|_|jr!|j||j|_|j |}|jr,|js |j|j|_|jr|dddk7r|dz}||jz}|jr+|dddk7r|dz}||j|jz}|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%) rmessagerr!rasctimer3rrr/rr5)rrr s r>rzFormatter.formats **, ==?!__VT\\BFN   v & ????"&"6"6v"G ??v~HFOO#A   v~HD$$V%6%677Ar=)NNrTr9)rrrrr localtimerrrrr!r/rr3r5rr<r=r>rr"sL)VI6.#6&& * r=rc*eZdZdZddZdZdZdZy)rzB A formatter suitable for formatting a number of records. Nc.|r||_yt|_y)zm Optionally specify a formatter which will be used to format each individual record. N)linefmt_defaultFormatter)rr<s r>rzBufferingFormatter.__init__s "DL,DLr=cy)zE Return the header string for the specified records. rr<rrecordss r> formatHeaderzBufferingFormatter.formatHeaderr=cy)zE Return the footer string for the specified records. rr<r?s r> formatFooterzBufferingFormatter.formatFooterrBr=cd}t|dkDrM||j|z}|D] }||jj|z}"||j |z}|S)zQ Format the specified records and return the result as a string. rr)rrAr<rrD)rr@rfrs r>rzBufferingFormatter.formatsg wrrs-  r=rceZdZdZddZdZy)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. c2||_t||_y)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)rrnlenrrs r>rzFilter.__init__ s I r=c|jdk(ry|j|jk(ry|jj|jd|jdk7ry|j|jdk(S)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.)rHrrr2s r>filterz Filter.filtersc 99> YY&++ % [[  diiDII 6! ; DII&#-.r=N)r)rrrrrrLr<r=r>r r s   /r=r c(eZdZdZdZdZdZdZy)Filtererz[ A base class for loggers and handlers which allows them to share common code. cg|_y)zE Initialize the list of filters to be an empty list. N)filtersrs r>rzFilterer.__init__+s  r=cX||jvr|jj|yy)z; Add the specified filter to this handler. N)rPappendrrLs r> addFilterzFilterer.addFilter1s'$,,& LL   ''r=cX||jvr|jj|yy)z@ Remove the specified filter from this handler. N)rPremoverSs r> removeFilterzFilterer.removeFilter8s' T\\ ! LL   ' "r=c|jD]?}t|dr|j|}n||}|syt|ts>|}A|S)a 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 by returning a false value. If a filter attached to a handler returns a log record instance, then that instance is used in place of the original log record in any further processing of the event by that handler. If a filter returns any other true value, the original log record is used in any further processing of the event by that handler. If none of the filters return false values, this method returns a log record. If any of the filters return a false value, this method returns a false value. .. versionchanged:: 3.2 Allow filters to be just callables. .. versionchanged:: 3.12 Allow filters to return a LogRecord instead of modifying it in place. rLF)rPrrLrar)rrfrCs r>rLzFilterer.filter?sO2Aq(#&)6&), r=N)rrrrrrTrWrLr<r=r>rNrN&s (("r=rNcttt}}}|r'|r$|r!| |j||yyyy#t$rYwxYw#|wxYw)zD Remove a handler reference from the internal cleanup list. N)rErF _handlerListrVrd)wrrjrlhandlerss r>_removeHandlerRefr^jsZ".|\hWG7x   OOB  I (7w    Is!= A A A  A Act tjtj|t t y#t wxYw)zL Add a handler to the internal cleanup list using a weak reference. N)rEr[rRweakrefrefr^rFrxs r>_addHandlerRefrb|s3NGKK1BCD s -A Ac,tj|S)za Get a handler with the specified *name*, or None if there isn't one with that name. ) _handlersrArs r>r0r0s == r=cRttj}t|S)z= Return all known handler names as an immutable set. )rrdr frozenset)rCs r>r1r1s ! "F V r=ceZdZdZefdZdZdZeeeZ dZ dZ dZ dZ d Zd Zd Zd Zd ZdZdZdZdZy)raq 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. ctj|d|_t||_d|_d|_t||jy)zz Initializes the instance - basically setting the formatter to None and the filter list to empty. NF) rNr_namergrB formatter_closedrb createLockrrBs r>rzHandler.__init__sE $  '  t r=c|jSr9)rjrs r>rzHandler.get_names zzr=ct |jtvrt|j=||_|r |t|<ty#twxYwr9)rErjrdrFrIs r>set_namezHandler.set_namesB zzY&djj)DJ"& $ NLNs 5A AcLtj|_t|y)zU Acquire a thread lock for serializing access to the underlying I/O. N)rRLocklockrqrs r>rmzHandler.createLocksOO% %d+r=c8|jjyr9)rtrwrs r>rwzHandler._at_fork_reinits !!#r=cR|jr|jjyy)z. Acquire the I/O thread lock. N)rtrjrs r>rjzHandler.acquire  99 II    r=cR|jr|jjyy)z. Release the I/O thread lock. N)rtrlrs r>rlzHandler.releaserwr=c$t||_y)zX Set the logging level of this handler. level must be an int or a str. N)rgrBrns r>setLevelzHandler.setLevels!' r=cb|jr |j}nt}|j|S)z Format the specified record. If a formatter is set, use it. Otherwise, use the default formatter for the module. )rkr=r)rrrs r>rzHandler.formats( >>..C#Czz&!!r=ctd)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 subclasses)NotImplementedErrorr2s r>emitz Handler.emits"#:; ;r=c|j|}t|tr|}|r4|j |j ||j |S|S#|j wxYw)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 an instance of the log record that was emitted if it passed all filters, otherwise a false value is returned. )rLrarrjr~rl)rrrfs r>handlezHandler.handles][[  b) $F LLN  &!  r  s AA.c||_y)z5 Set the formatter for this handler. N)rkrs r> setFormatterzHandler.setFormatter s r=cy)z Ensure all logging output has been flushed. This version does nothing and is intended to be implemented by subclasses. Nr<rs r>flushz Handler.flushs r=ct d|_|jr#|jtvrt|j=t y#t wxYw)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. TN)rErlrjrdrFrs r>r+z Handler.closes>  DLzzdjjI5djj) NLNs 6A Ac>trtjrtj\}}} tjj dt j |||dtjtjj d|j}|rtjj|jjtdk(rL|j}|r>tjj|jjtdk(rL|r&t j|tjn:tjj d|j d|j"d tjj d |j$d |j&d~~~yyy#t($rt*$r"tjj d Y9wxYw#t,$rYHwxYw#~~~wxYw) 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: rfilezLogged from file z, line r%z Message: z Arguments: zwUnable to print the message and arguments - possible formatting error. Use the traceback above to help find the error. )r.rKstderrrwriter(r)rPrWrXdirnamerZr[__path__rQ print_stackr^rrrRecursionErrorrNOSError)rrtvr.r]s r> handleErrorzHandler.handleError*s szz||~HAq"    !:;))!QD#**E   1 1I1I!J{"#!LLE1I1I!J{"#))%cjjAJJ$$%+__fmm&EF &JJ$$:@**:@++&GHq"C *?.& &JJ$$&R&&   q"sIC;H.A"H:G1HHHH HHHHHcft|j}d|jjd|dS)N< ()>)r!rBrrrns r>rzHandler.__repr__Ys%TZZ("nn55u==r=N)rrrrrrrrqpropertyrrmrwrjrlrzrr~rrrr+rrr<r=r>rrsk$   Hh 'D,$  ( ";,  $-^>r=rcDeZdZdZdZd dZdZdZdZdZ e e Z y) 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%Nc`tj||tj}||_y)zb Initialize the handler. If stream is not specified, sys.stderr is used. N)rrrKrstreamrrs r>rzStreamHandler.__init__fs'  >ZZF r=c|j |jr0t|jdr|jj|j y#|j wxYw)z% Flushes the stream. rN)rjrrrrlrs r>rzStreamHandler.flushqsI  {{wt{{G< !!# LLNDLLNs r~zStreamHandler.emit|sd %++f%C[[F LLt. / JJL   %   V $ %sA A#A43A4c||jurd}|S|j}|j |j||_|j|S#|jwxYw)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)rrjrrl)rrrCs r> setStreamzStreamHandler.setStreams` T[[ F [[F LLN  $    s AA+ct|j}t|jdd}t |}|r|dz }d|j j d|d|dS)Nrr r(r)r!rBgetattrrrcrr)rrBrs r>rzStreamHandler.__repr__sOTZZ(t{{FB/4y  CKD $ 7 7uEEr=r9) rrrrrrrr~rr classmethodr__class_getitem__r<r=r>rr]s5 J  %,(F$L1r=rc0eZdZdZddZdZdZdZdZy) r zO A handler class which writes formatted logging records to disk files. Nctj|}tjj||_||_||_d|vrtj||_||_ ||_ t|_ |rtj|d|_yt j||j#y)zO Open the specified file and use it as the stream for logging. bN)rWfspathrXabspath baseFilenamemodeencodingr& text_encodingerrorsdelayopen _builtin_openrrrr_open)rr^rrrrs r>rzFileHandler.__init__s 99X&GGOOH5   d?,,X6DM  "    T "DK  " "4 6r=c|j |jrA |j|j}d|_t|dr|j  t j | |j y#|j}d|_t|dr|j wwxYw#t j |wxYw#|j wxYw)z$ Closes the stream. Nr+)rjrrrr+rrlrs r>r+zFileHandler.closes   *;;+ !%&* "673"LLN ##D) LLN"&&* "673"LLN4##D) LLNs3 B<B0B< C2B99B<<CCC(c|j}||j|j|j|jS)zx Open the current base file with the (original) mode and encoding. Return the resulting stream. rr)rrrrr)r open_funcs r>rzFileHandler._opens9 && **DII"&-- E Er=c|j0|jdk7s |js|j|_|jrtj ||yy)a- Emit a record. If the stream was not opened because 'delay' was specified in the constructor, open it before calling the superclass's emit. If stream is not open, current mode is 'w' and `_closed=True`, record will not be emitted (see Issue #42378). Nw)rrrlrrr~r2s r>r~zFileHandler.emitsI ;; yyCt||"jjl ;;   tV , r=ct|j}d|jjd|jd|dSNrrrr)r!rBrrrrns r>rzFileHandler.__repr__s-TZZ(!%!8!8$:K:KUSSr=)aNFN) rrrrrr+rr~rr<r=r>r r s"760E- Tr=r c*eZdZdZefdZedZy)_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. c0tj||y)z) Initialize the handler. N)rrrns r>rz_StderrHandler.__init__ s u%r=c"tjSr9)rKrrs r>rz_StderrHandler.streams zzr=N)rrrrrrrrr<r=r>rrs% $& r=rceZdZdZdZdZy) 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. c|di|_y)zY Initialize with the specified logger being a child of this placeholder. N loggerMapraloggers r>rzPlaceHolder.__init__%s#T+r=c@||jvrd|j|<yy)zJ Add the specified logger as a child of this placeholder. Nrrs r>rRzPlaceHolder.append+s# $.. (&*DNN7 # )r=N)rrrrrrRr<r=r>rrs , +r=rcj|tk7r(t|tstd|jz|ay)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 issubclassrer _loggerClass)klasss r>r'r'6s8  %(F#nn-. .Lr=ctS)zB Return the class to be used when instantiating a logger. )rr<r=r>r#r#Cs  r=cneZdZdZdZedZejdZdZdZ dZ dZ d Z d Z y ) Managerzt There is [under normal circumstances] just one Manager instance, which holds the hierarchy of loggers. cX||_d|_d|_i|_d|_d|_y)zT Initialize the manager with the root node of the logger hierarchy. rFN)rootremittedNoHandlerWarning loggerDict loggerClasslogRecordFactory)rrootnodes r>rzManager.__init__Ns1  ',$ $r=c|jSr9)_disablers r>rzManager.disableYs }}r=c$t||_yr9)rgrrvalues r>rzManager.disable]s#E* r=cd}t|ts tdt ||jvru|j|}t|t r|}|j xst|}||_||j|<|j|||j|nA|j xst|}||_||j|<|j|t|S#twxYw)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) rarcrerErrrrmanager_fixupChildren _fixupParentsrF)rrrfphs r>r"zManager.getLoggeras$$<= = t&__T*b+.B:$**:lDAB!%BJ,.DOOD)''B/&&r*6d&&6,=! (*%""2& N  Ns CC99 Dct|tk7r(t|tstd|jz||_y)zY Set the class to be used when instantiating a logger with this Manager. rN)rrrerr)rrs r>r'zManager.setLoggerClasss9 F?eV, J"'..!122 r=c||_y)zg Set the factory to be used when instantiating a log record with this Manager. N)r)rrs r>r,zManager.setLogRecordFactorys !(r=ct|j}|jd}d}|dkDr|s}|d|}||jvrt||j|<n3|j|}t |t r|}n|j ||jdd|dz }|dkDr|s}|s |j}||_y)z Ensure that there are either loggers or placeholders all the way from the specified logger to the root of the logger hierarchy. rKNrrJ) rrfindrrrarrRrparent)rrrirfsubstrobjs r>rzManager._fixupParentss || JJsO 1ub"1XFT__,*5g*>'oof-c6*BJJw' 31q5)A1ubBr=c|j}t|}|jjD]7}|jjd||k7s |j|_||_9y)zk Ensure that children of the placeholder ph are connected to the specified logger. N)rrrrr)rrrrnamelencs r>rzManager._fixupChildrensV ||d)""$Axx}}Xg&$.!"" %r=ct|jjD]-}t|ts|j j /|jj j ty)zj Clear the cache for all loggers in loggerDict Called when level changes are made N) rErrrar_cacheclearrrFrloggers r> _clear_cachezManager._clear_cachesW oo,,.F&&) ##%/  r=N)rrrrrrrsetterr"r'r,rrrr<r=r>rrIsW % ^^++ D!(0 # r=rceZdZdZefdZdZdZdZdZ dZ dZ d d d Z d Z d ZdZddZ ddZ d dZdZdZdZdZdZdZdZdZdZdZdZy)!rar 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. ctj|||_t||_d|_d|_g|_d|_i|_ y)zJ Initialize the logger with a name and an optional level. NTF) rNrrrgrBr propagater]disabledr)rrrBs r>rzLogger.__init__sH $  '     r=cXt||_|jjy)zW Set the logging level of this logger. level must be an int or a str. N)rgrBrrrns r>rzzLogger.setLevels !'  !!#r=cb|jtr|jt||fi|yy)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=True) N) isEnabledForr _logrrrrs r>rz Logger.debug.   U # DIIeS$ 1& 1 $r=cb|jtr|jt||fi|yy)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", "notable problem", exc_info=True) N)rrrrs r>r$z Logger.infos.   T " DIIdC 0 0 #r=cb|jtr|jt||fi|yy)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=True) N)rrrrs r>r*zLogger.warnings.   W % DIIgsD 3F 3 &r=cftjdtd|j|g|i|yNz6The 'warn' method is deprecated, use 'warning' insteadr#warningsr)DeprecationWarningr*rs r>r)z Logger.warn0 $%7 < S*4*6*r=cb|jtr|jt||fi|yy)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=True) N)rr rrs r>rz Logger.errorrr=Trc4|j|g|d|i|y)zU Convenience method for logging an ERROR with exception information. rNrrrrrrs r>rzLogger.exception"s!  3;;;F;r=cb|jtr|jt||fi|yy)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=True) N)rrrrs r>rzLogger.critical(s.   X & DIIhT 4V 4 'r=c0|j|g|i|y)z@ Don't use this method, use critical() instead. Nrrs r>r z Logger.fatal4s  c+D+F+r=ct|tstr tdy|j |r|j |||fi|yy)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=True) zlevel must be an integerN)rarbr.rerrrrBrrrs r>r%z Logger.log:sJ%% :;;   U # DIIeS$ 1& 1 $r=ct}|y|dkDr'|j}|n|}t|s|dz}|dkDr'|j}d}|rbt j 5}|j dtj|||j}|ddk(r|dd}ddd|j|j|j|fS#1swY-xYw) z Find the stack frame of the caller so that we can note the source file name, line number and function name. N)(unknown file)r(unknown function)NrrJzStack (most recent call last): rr$r%) rSrQr_rZr&r'rr(rr*r[f_linenoco_name)rr stacklevelrYnext_fcorr-s r> findCallerzLogger.findCallerKs N 9B1nXXF~ A%a(a 1nXX # <=%%ac2 9$!#2JE  ~~qzz2::u<< s ACCNc t||||||||| } | 9| D]4} | dvs| | jvrtd| z| | | j| <6| S)zr A factory method which can be overridden in subclasses to create specialized LogRecords. )r7r8z$Attempt to overwrite %r in LogRecord)rrr) rrrBfnlnorrrrextrarrfkeys r> makeRecordzLogger.makeRecordmso tUBS$$"$  11sbkk7I"#IC#OPP#(: C  r=c d}tr |j||\} } } }nd\} } } |rMt|trt |||j f}n$t|tstj}|j|j|| | |||| || } |j| y#t$r d\} } } YwxYw)z Low-level logging routine which creates a LogRecord and then calls all the handlers of this logger to handle the record. N)rrr) r\rrdra BaseExceptiontyperOtuplerKrrrr) rrBrrrrrrrrrrrs r>rz Logger._log|s   J'+z:'N$CuFMBT (M2 NHh6L6LM%0<<>E2sC!)4? F J I C JsB--B?>B?c|jry|j|}|syt|tr|}|j |y)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)rrLrar callHandlers)rr maybe_records r>rz Logger.handles? == {{6*   lI .!F &!r=ct ||jvr|jj|ty#twxYw)z; Add the specified handler to this logger. N)rEr]rRrFrhdlrs r> addHandlerzLogger.addHandlers7  DMM) $$T* NLN )A A ct ||jvr|jj|ty#twxYw)z@ Remove the specified handler from this logger. N)rEr]rVrFr(s r> removeHandlerzLogger.removeHandlers7  t}}$ $$T* NLNr+cp|}d}|r/|jrd} |S|js |S|j}|r/|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]rr)rrrfs r> hasHandlerszLogger.hasHandlerssQ  zz  ;; HH r=c|}d}|r_|jD]2}|dz}|j|jk\s"|j|4|jsd}n |j }|r_|dk(rt r4|jt jk\rt j|yytrU|jjs>tjjd|jzd|j_ yyyy)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. rrJNz+No handlers could be found for logger "%s" T)r]rrBrrrr-r.rrrKrrr)rrrfoundr)s r>r%zLogger.callHandlerss   >>TZZ/KK'#;;HH QJ>>Z%5%55%%f-6 )M)M   "-/3yy"9:7; 4*N r=cd|}|r'|jr |jS|j}|r'tS)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. )rBrrrs r>getEffectiveLevelzLogger.getEffectiveLevels2||||#]]F r=cB|jry |j|S#t$rwt |jj |k\rdx}|j|<n"||j k\x}|j|<tn#twxYw|cYSwxYw); Is this logger enabled for level 'level'? F)rrrrErrr3rF)rrB is_enableds r>rzLogger.isEnabledFors == ;;u% %  N <<''506;;JU!3!7!7!99JU!3   s'BA B ? B BBBc|j|urdj|j|f}|jj |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. rK)rrrrr")rsuffixs r>getChildzLogger.getChilds< 99D XXtyy&12F||%%f--r=cdjj}t tfd|j Dt S#t wxYw)Ncp||jjuryd|jjdzS)NrrJrK)rrrcount)rs r> _hierlevelz&Logger.getChildren.._hierlevel)s1,,,v{{((-- -r=c3K|]B}t|tr0|jur"|d|jzk(r|Dyw)rJN)rarr).0itemr=rs r> z%Logger.getChildren..4sHH $T62t{{d7J!$'1z$++/F+FF sAA )rrrErrrF)rr r=s` @r> getChildrenzLogger.getChildren'sO . LL # # H HH NLNs "A A ct|j}d|jjd|jd|dSr)r!r3rrrrns r>rzLogger.__repr__:s0T3356!%!8!8$))UKKr=ct|j|urddl}|jdt|jffS)Nrzlogger cannot be pickled)r"rpickle PicklingError)rrEs r> __reduce__zLogger.__reduce__>s9 TYY t + &&'AB B499,&&r=)FrJ)NNN)NNFrJ)rrrrrrrzrr$r*r)rrrr r%rrrrr*r-r/r%r3rr9rBrrGr<r=r>rrs $* $ 2 1 4+ 2.2< 5, 2" =F15 LQ4"  ,<< ,.&&L'r=rceZdZdZdZdZy) 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. c2tj|d|y)z= Initialize the logger with the name "root". rN)rrrns r>rzRootLogger.__init__Ks fe,r=ctdfSr)r"rs r>rGzRootLogger.__reduce__Qs "}r=N)rrrrrrGr<r=r>rIrIEs - r=rIceZdZdZddZdZdZdZdZdZ d Z d d d Z d Z dZ dZdZdZdZdZedZej*dZedZdZeeZy)rzo An adapter for loggers which makes it easier to specify contextual information in logging output. Nc ||_||_y)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)rr)rrrs r>rzLoggerAdapter.__init__\s  r=c(|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. r)r)rrrs r>rzLoggerAdapter.processjs**wF{r=c:|jt|g|i|y)zA Delegate a debug call to the underlying logger. N)r%r rs r>rzLoggerAdapter.debugz -d-f-r=c:|jt|g|i|y)zA Delegate an info call to the underlying logger. N)r%rrs r>r$zLoggerAdapter.infos s,T,V,r=c:|jt|g|i|y)zC Delegate a warning call to the underlying logger. N)r%rrs r>r*zLoggerAdapter.warnings #///r=cftjdtd|j|g|i|yrrrs r>r)zLoggerAdapter.warnrr=c:|jt|g|i|y)zB Delegate an error call to the underlying logger. Nr%r rs r>rzLoggerAdapter.errorrPr=Trc>|jt|g|d|i|y)zF Delegate an exception call to the underlying logger. rNrUr s r>rzLoggerAdapter.exceptions# @d@X@@r=c:|jt|g|i|y)zD Delegate a critical call to the underlying logger. N)r%rrs r>rzLoggerAdapter.criticals 3000r=c|j|r7|j||\}}|jj||g|i|yy)z Delegate a log call to the underlying logger, after adding contextual information from this adapter instance. N)rrrr%rs r>r%zLoggerAdapter.logsI   U #,,sF3KC DKKOOE3 8 8 8 $r=c8|jj|S)r5)rrrns r>rzLoggerAdapter.isEnabledFors{{''..r=c:|jj|y)zC Set the specified level on the underlying logger. N)rrzrns r>rzzLoggerAdapter.setLevels U#r=c6|jjS)zD Get the effective level for the underlying logger. )rr3rs r>r3zLoggerAdapter.getEffectiveLevels{{,,..r=c6|jjS)z@ See if the underlying logger has any handlers. )rr/rs r>r/zLoggerAdapter.hasHandlerss{{&&((r=c @|jj|||fi|S)zX Low-level log implementation, proxied to allow nested logger adapters. )rrrs r>rzLoggerAdapter._logs$ t{{sD;F;;r=c.|jjSr9rrrs r>rzLoggerAdapter.managers{{"""r=c&||j_yr9r_rs r>rzLoggerAdapter.managers# r=c.|jjSr9)rrrs r>rzLoggerAdapter.names{{r=c|j}t|j}d|jjd|j d|dSr)rr!r3rrr)rrrBs r>rzLoggerAdapter.__repr__s9V5578!%!8!8&++uMMr=r9)rrrrrrrr$r*r)rrrr%rrzr3r/rrrrrrrrrr<r=r>rrVs   . - 0 + . .2A 1 9/ $ / ) < ## ^^$$  N $L1r=rc t |jdd}|jdd}|jdd}|r=tjddD]'}tj ||j )t tjdk(r|jdd}|d |vr"d |vrtd d |vsd |vr td |r|jd d}|jd d}|r,d|vrd}ntj|}t||||}n|jd d}t|}|g}|jdd} |jdd} | tvr/tddjtjz|jdt| d} t| | | } |D]4}|j |j#| tj%|6|jdd} | tj'| |r-dj|j}td|zt)y#t)wxYw)a8 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 logger. 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. forceFrNrbackslashreplacerr]rr^z8'stream' and 'filename' should not be specified togetherzG'stream' or 'filename' should not be specified together with 'handlers'filemoderrrrrrrrrrJrBrzUnrecognised argument(s): %s)rEpoprr]r-r+rrdr&rr rrrrrrkrr*rzrF)rrdrrhr]r^rrdfsrfsrrBrs r>rrsTLN2 7E*::j$/H&89 ]]1%""1% & t}}  "zz*d3Hv%**>$&:;;v%v)=$&JKK!::j$7zz*c2d{!%#%#3#3H#=#Hd-5fFA$ZZ$7F%f-A3**Y-CJJw,EG# !;chh!(?1"122HgenQ&78BBU+C;;&NN3'"JJw-E  e$yy/ !?$!FGG s II,, I8c|r#t|tr|tjk(rtStj j |S)z Return a logger with the specified name, creating it if necessary. If no name is specified, return the root logger. )rarcrrrrr"res r>r"r"es5 :dC(TTYY-> >> # #D ))r=cttjdk(r ttj|g|i|y)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)rrr]rrrrrs r>rros0  4==Q MM#'''r=c"t|g|i|y)z: Don't use this function, use critical() instead. Nrrms r>r r ys S"4"6"r=cttjdk(r ttj|g|i|y)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)rrr]rrrms r>rr0  4==Q JJs$T$V$r=rc&t|g|d|i|y)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. rNr )rrrrs r>rrs  #22x262r=cttjdk(r ttj|g|i|y)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)rrr]rr*rms r>r*r*s0  4==Q LL&t&v&r=cXtjdtdt|g|i|y)Nz8The 'warn' function is deprecated, use 'warning' insteadr#rrms r>r)r)s* MM !3Q8 C!$!&!r=cttjdk(r ttj|g|i|y)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)rrr]rr$rms r>r$r$s0  4==Q IIc#D#F#r=cttjdk(r ttj|g|i|y)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)rrr]rrrms r>rrrpr=cttjdk(r ttj||g|i|y)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)rrr]rr%)rBrrrs r>r%r%s2  4==Q HHUC)$)&)r=cj|tj_tjjy)zB Disable all logging calls of severity 'level' and below. N)rrrr)rBs r>rrs !DLLLLr=cJt|ddD]Z} |}|rN |jt|ddr|j|j |j\y#t t f$rY$wxYw#|jwxYw#trYxYw)z Perform any cleanup actions in the logging system (e.g. flushing buffers). Should be called at application exit. N flushOnCloseT) reversedrjrrr+rrdrlr.) handlerListr\rhs r>r(r(s{1~& A IIKq.$7 GGIIIK+' ,  IIK s: B=A-B-A?<B>A??BBB B"c(eZdZdZdZdZdZdZy)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. cyzStub.Nr<r2s r>rzNullHandler.handler=cyr~r<r2s r>r~zNullHandler.emitrr=cd|_yr9)rtrs r>rmzNullHandler.createLocks  r=cyr9r<rs r>rwzNullHandler._at_fork_reinit rrr=N)rrrrrr~rmrwr<r=r>rrs r=rc|tt||||||yytj|||||}td}|js|j t |jt|y)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.warnings) _warnings_showwarningr formatwarningr"r]r*rr*rc)r7categoryr^rrliner rs r> _showwarningr st  , !'8XvtT R -  " "7Hh M=)   km , s1vr=c|r't tjatt_yyttt_dayy)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)rr showwarningr)captures r>rr sA ($,$8$8 !#/H  ) ! ,#8H $( ! -r=r9r)vrrKrWrr&rr(rr`collections.abcrtypesrstringrr StrFormatter__all__r __author__ __status__ __version____date__rr.rrrrrr r rrrr rr@r:r/r!rrrSrXrY__code__r[r\r_rgrsrirErFrqWeakSetrtrzrmobjectrrr,r+r&rrrrrrr=rr rNWeakValueDictionaryrdr[r^rbr0r1rrr r_defaultLastResortr-rr'r#rrrIrrrrrr"rr rrr*r)r$rr%rr(atexitregisterrrrrr<r=r>rs"LKKKK, 26    TYY[            j 7 Y& 7 H         6  3 +L5& 77  L11== > 0  r%& $37??#4  B|'H(46kk`  M6MB:\:D ., .F4   % 8 9 @ A  nnfK$$T#/V#/J;v;B (G ' ' )  $D>hD>LR2GR2jRT-RTj]"$G,  +&+.  {f{Bx'Xx'v   E2FE2N' % y@*(# %$(3'" $%* &F ' 0()r=