+
    üÐjØ?  ã                  óò   € R t ^ RIHt ^ RIHt ^ RIHt ^ RIHtHtH	t	H
t
HtHt ^ RIHt ^ RIHt ^RIHtHt ^RIHtHt  ! R	 R
]4      t ! R R4      t ! R R4      t ! R R4      t]! 4       tR R ltR# )z
Logger class.
)Úannotations)Útime)ÚTracebackType)ÚAnyÚCallableÚContextManagerÚOptionalÚProtocolÚcast)Úcurrentframe)ÚFailure)ÚILogObserverÚLogTrace)ÚInvalidLogLevelErrorÚLogLevelc                  ó\   € ] tR t^tRt]R R l4       t]R R l4       t]R R l4       tRt	R	# )
Ú	Operationz�
An L{Operation} represents the success (or lack thereof) of code performed
within the body of the L{Logger.failureHandler} context manager.
c               ó   € V ^8„  d   QhRR/# ©é   ÚreturnÚbool© )Úformats   "Ú8/usr/lib/python3/dist-packages/twisted/logger/_logger.pyÚ__annotate__ÚOperation.__annotate__   s   € ÷ ñ ˜4ñ ó    c                ó   € R# )z¥
Did the operation succeed?  C{True} iff the code completed without
raising an exception; C{False} while the code is running and C{False}
if it raises an exception.
Nr   ©Úselfs   &r   Ú	succeededÚOperation.succeeded   ó   ‚ r   c               ó   € V ^8„  d   QhRR/# )r   r   úFailure | Noner   )r   s   "r   r   r   $   s   € ÷ ñ ˜ñ r   c                ó   € R# )zR
Did the operation raise an exception?  If so, this L{Failure} is that
exception.
Nr   r   s   &r   ÚfailureÚOperation.failure#   r#   r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   +   s   € ÷ ñ ˜ñ r   c                ó   € R# )z“
Did the operation fail?  C{True} iff the code raised an exception;
C{False} while the code is running and C{False} if it completed without
error.
Nr   r   s   &r   ÚfailedÚOperation.failed*   r#   r   r   N)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úpropertyr!   r'   r+   Ú__static_attributes__r   r   r   r   r      sC   † ñð
 ôó ðð ôó ðð ôó ôr   r   c                  ón   € ] tR t^3t$ RtR]R&   RtR]R&   R R lt]R	 R
 l4       t	R R lt
R R ltRtR# )Ú_FailCtxMgrFr   r!   Nr%   r'   c               ó    € V ^8„  d   QhRRRR/# ©r   ÚfailzCallable[[Failure], None]r   ÚNoner   )r   s   "r   r   Ú_FailCtxMgr.__annotate__7   ó   € ÷ ñ Ð6ð ¸4ñ r   c                	ó   € Wn         R # ©N©Ú_fail©r    r8   s   &&r   Ú__init__Ú_FailCtxMgr.__init__7   ó   € ØŽ
r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r:   ;   s   € ÷ (ñ (˜ñ (r   c                	ó   € V P                   R J# r=   ©r'   r   s   &r   r+   Ú_FailCtxMgr.failed:   s   € à�|‰| 4Ð'Ð'r   c               ó   € V ^8„  d   QhRR/# )r   r   r   r   )r   s   "r   r   r:   >   s   € ÷ ñ ˜9ñ r   c                	ó   € V # r=   r   r   s   &r   Ú	__enter__Ú_FailCtxMgr.__enter__>   s   € Øˆr   c               ó(   € V ^8„  d   QhRRRRRRRR/# ©	r   Úexc_typeztype[BaseException] | NoneÚ	exc_valuezBaseException | NoneÚ	tracebackzTracebackType | Noner   r   r   )r   s   "r   r   r:   A   s2   € ÷ ñ à,ðð (ðð (ð	ð 
ñr   c               	ób   € Ve$   \        4       pW@n        V P                  V4       R# RV n        R# ©NT)r   r'   r?   r!   ©r    rN   rO   rP   r'   s   """" r   Ú__exit__Ú_FailCtxMgr.__exit__A   s3   € ð ÒÜ“iˆGØ"ŒLØ�J‰J�wÔñ ð "ˆDŒNÙr   )r?   r'   r!   )r-   r.   r/   r0   r!   Ú__annotations__r'   rA   r2   r+   rJ   rT   r3   r   r   r   r5   r5   3   s>   ‡ Ø€IˆtÓØ"€Gˆ^Ó"õð ô(ó ð(õ÷ñ r   r5   c                  ó:   € ] tR t^QtR R ltR R ltR R ltRtR# )	Ú_FastFailCtxMgrc               ó    € V ^8„  d   QhRRRR/# r7   r   )r   s   "r   r   Ú_FastFailCtxMgr.__annotate__R   r;   r   c                	ó   € Wn         R # r=   r>   r@   s   &&r   rA   Ú_FastFailCtxMgr.__init__R   rC   r   c               ó   € V ^8„  d   QhRR/# )r   r   r9   r   )r   s   "r   r   rZ   U   s   € ÷ ñ ˜4ñ r   c                	ó   € R # r=   r   r   s   &r   rJ   Ú_FastFailCtxMgr.__enter__U   s   € Ùr   c               ó(   € V ^8„  d   QhRRRRRRRR/# rM   r   )r   s   "r   r   rZ   X   s2   € ÷ ñ à,ðð (ðð (ð	ð 
ñr   c               	óP   € Ve"   \        4       pW@n        V P                  V4       R# rR   )r   r'   r?   rS   s   """" r   rT   Ú_FastFailCtxMgr.__exit__X   s%   € ð ÒÜ“iˆGØ"ŒLØ�J‰J�wÔÙr   )r?   r'   N)r-   r.   r/   r0   rA   rJ   rT   r3   r   r   r   rX   rX   Q   s   † õõ÷ñ r   rX   c                  ó0  € ] tR t^ftRt]R R l4       tRR R lltRR R lltR	 R
 lt	RR R llt
R]P                  3R R lltRR R lltRR R lltRR R lltRR R lltRR R llt]P                  3R R llt]P                  3R R lltRtR# ) ÚLoggerab  
A L{Logger} emits log messages to an observer.  You should instantiate it
as a class or module attribute, as documented in L{this module's
documentation <twisted.logger>}.

@ivar namespace: the namespace for this logger
@ivar source: The object which is emitting events via this logger
@ivar observer: The observer that this logger will send events to.
c               ó   € V ^8„  d   QhRR/# ©r   r   Ústrr   )r   s   "r   r   ÚLogger.__annotate__r   s   € ÷ 	ñ 	¨#ñ 	r   c                 ó|   €  \        \        \        ^4      P                  R,          4      #   \         d     R# i ; i)z{
Derive a namespace from the module containing the caller's caller.

@return: the fully qualified python name of a module.
r-   z	<unknown>)r
   rg   r   Ú	f_globalsÚKeyErrorr   r   r   Ú_namespaceFromCallingContextÚ#Logger._namespaceFromCallingContextq   s5   € ð	Üœœ\¨!›_×6Ñ6°zÕBÓCÐCøÜô 	Úð	ús   ‚), ¬;º;Nc               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   Ú	namespaceúOptional[str]ÚsourcezOptional[object]ÚobserverzOptional['ILogObserver']r   r9   r   )r   s   "r   r   rh   }   s2   € ÷ %ñ %à ð%ð !ð%ð +ð	%ð
 
ñ%r   c                óv   € Vf   V P                  4       pWn        W n        Vf   ^RIHp W@n        R# W0n        R# )aë  
@param namespace: The namespace for this logger.  Uses a dotted
    notation, as used by python modules.  If not L{None}, then the name
    of the module of the caller is used.
@param source: The object which is emitting events via this
    logger; this is automatically set on instances of a class
    if this L{Logger} is an attribute of that class.
@param observer: The observer that this logger will send events to.
    If L{None}, use the L{global log publisher <globalLogPublisher>}.
N)ÚglobalLogPublisher)rl   ro   rq   Ú_globalrt   rr   )r    ro   rq   rr   rt   s   &&&& r   rA   ÚLogger.__init__}   s5   € ð  ÒØ×9Ñ9Ó;ˆIà"ŒØŒàÒÝ3à*<ŽMà$ŽMr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   ÚinstanceÚobjectÚownerzOptional[type]r   z'Logger'r   )r   s   "r   r   rh   š   s!   € ÷ 
ñ 
 ð 
¨~ð 
Èñ 
r   c                ó¦   € Vf   Q hVf   TpMTpV P                  RP                  VP                  VP                  .4      VV P                  R7      # )a  
When used as a descriptor, i.e.::

    # File: athing.py
    class Something:
        log = Logger()
        def hello(self):
            self.log.info("Hello")

a L{Logger}'s namespace will be set to the name of the class it is
declared on.  In the above example, the namespace would be
C{athing.Something}.

Additionally, its source will be set to the actual object referring to
the L{Logger}.  In the above example, C{Something.log.source} would be
C{Something}, and C{Something().log.source} would be an instance of
C{Something}.
Ú.)rr   )Ú	__class__Újoinr.   r-   rr   )r    rx   rz   rq   s   &&& r   Ú__get__ÚLogger.__get__š   s[   € ð& Ò Ð Ð àÒØ‰FàˆFà�~‰~Ø�H‰H�e×&Ñ&¨¯©Ð7Ó8ØØ—]‘]ð ó 
ð 	
r   c               ó   € V ^8„  d   QhRR/# rf   r   )r   s   "r   r   rh   º   s   € ÷ Añ A˜#ñ Ar   c                	óR   € R V P                   P                   RV P                  : R2# )Ú<Ú Ú>)r}   r-   ro   r   s   &r   Ú__repr__ÚLogger.__repr__º   s'   € Ø�4—>‘>×*Ñ*Ð+¨1¨T¯^©^Ñ,>¸aÐ@Ð@r   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   Úlevelr   r   rp   Úkwargsry   r   r9   r   )r   s   "r   r   rh   ½   s,   € ÷ %ñ %Øð%Ø'4ð%ØGMð%à	ñ%r   c           	     óˆ  € V\         P                  ! 4       9  d*   V P                  R\        \	        V4      4      VV R7       R# TpVP                  V VV P                  V P                  V\        4       R7       RV9   d2   \        \        VR,          4      P                  W P                  34       V P                  V4       R# )aÍ  
Emit a log event to all log observers at the given level.

@param level: a L{LogLevel}
@param format: a message format using new-style (PEP 3101)
    formatting.  The logging event (which is a L{dict}) is
    used to render this format string.
@param kwargs: additional key/value pairs to include in the event.
    Note that values which are later mutated may result in
    non-deterministic behavior from observers that schedule work for
    later execution.
z:Got invalid log level {invalidLevel!r} in {logger}.emit().)ÚinvalidLevelÚloggerN)Ú
log_loggerÚ	log_levelÚlog_namespaceÚ
log_sourceÚ
log_formatÚlog_timeÚ	log_trace)r   Úiterconstantsr'   r   r   Úupdatero   rq   r   r
   r   Úappendrr   )r    r‰   r   rŠ   Úevents   &&&, r   ÚemitÚLogger.emit½   s«   € ð œ×.Ò.Ó0Ô0Ø�L‰LØLÜÔ,¨UÓ3Ó4Ø"Øð	 ô ñ àˆØ�‰ØØØŸ.™.Ø—{‘{ØÜ“Vð 	ô 	
ð ˜%ÔÜ”˜5 Õ-Ó.×5Ñ5°t¿]¹]Ð6KÔLà�‰�eÖr   c          
     ó,   € V ^8„  d   QhRRRRRRRRR	R
/# )r   r   rg   r'   zOptional[Failure]r‰   r   rŠ   ry   r   r9   r   )r   s   "r   r   rh   ä   sC   € ÷ 5@ñ 5@àð5@ð #ð5@ð ð	5@ð
 ð5@ð 
ñ5@r   c                óL   € Vf   \        4       pV P                  ! W13RV/VB  R# )au  
Log a failure and emit a traceback.

For example::

    try:
        frob(knob)
    except Exception:
        log.failure("While frobbing {knob}", knob=knob)

or::

    d = deferredFrob(knob)
    d.addErrback(lambda f: log.failure("While frobbing {knob}",
                                       f, knob=knob))

This method is meant to capture unexpected exceptions in code; an
exception that is caught and handled somehow should be logged, if
appropriate, via L{Logger.error} instead.  If some unknown exception
occurs and your code doesn't know how to handle it, as in the above
example, then this method provides a means to describe the failure.
This is done at L{LogLevel.critical} by default, since no corrective
guidance can be offered to an user/administrator, and the impact of the
condition is unknown.

@param format: a message format using new-style (PEP 3101) formatting.
    The logging event (which is a L{dict}) is used to render this
    format string.

@param failure: a L{Failure} to log.  If L{None}, a L{Failure} is
    created from the exception in flight.

@param level: a L{LogLevel} to use.

@param kwargs: additional key/value pairs to include in the event.
    Note that values which are later mutated may result in
    non-deterministic behavior from observers that schedule work for
    later execution.

@see: L{Logger.failureHandler}

@see: L{Logger.failuresHandled}
NÚlog_failure)r   r™   )r    r   r'   r‰   rŠ   s   &&&&,r   r'   ÚLogger.failureä   s'   € ðd Š?Ü“iˆGà�	Š	�%Ñ?¨WÐ?¸Ô?r   c               ó$   € V ^8„  d   QhRRRRRR/# ©r   r   rp   rŠ   ry   r   r9   r   )r   s   "r   r   rh     ó!   € ÷ 4ñ 4˜Mð 4¸Fð 4Àtñ 4r   c                óJ   € V P                   ! \        P                  V3/ VB  R# )a¨  
Emit a log event at log level L{LogLevel.debug}.

@param format: a message format using new-style (PEP 3101) formatting.
    The logging event (which is a L{dict}) is used to render this
    format string.

@param kwargs: additional key/value pairs to include in the event.
    Note that values which are later mutated may result in
    non-deterministic behavior from observers that schedule work for
    later execution.
N)r™   r   Údebug©r    r   rŠ   s   &&,r   r£   ÚLogger.debug  ó   € ð 	�	Š	”(—.‘. &Ñ3¨FÔ3r   c               ó$   € V ^8„  d   QhRRRRRR/# r    r   )r   s   "r   r   rh   *  ó!   € ÷ 3ñ 3˜=ð 3¸6ð 3Àdñ 3r   c                óJ   € V P                   ! \        P                  V3/ VB  R# )a§  
Emit a log event at log level L{LogLevel.info}.

@param format: a message format using new-style (PEP 3101) formatting.
    The logging event (which is a L{dict}) is used to render this
    format string.

@param kwargs: additional key/value pairs to include in the event.
    Note that values which are later mutated may result in
    non-deterministic behavior from observers that schedule work for
    later execution.
N)r™   r   Úinfor¤   s   &&,r   rª   ÚLogger.info*  ó   € ð 	�	Š	”(—-‘- Ñ2¨6Ô2r   c               ó$   € V ^8„  d   QhRRRRRR/# r    r   )r   s   "r   r   rh   9  r¨   r   c                óJ   € V P                   ! \        P                  V3/ VB  R# )a§  
Emit a log event at log level L{LogLevel.warn}.

@param format: a message format using new-style (PEP 3101) formatting.
    The logging event (which is a L{dict}) is used to render this
    format string.

@param kwargs: additional key/value pairs to include in the event.
    Note that values which are later mutated may result in
    non-deterministic behavior from observers that schedule work for
    later execution.
N)r™   r   Úwarnr¤   s   &&,r   r¯   ÚLogger.warn9  r¬   r   c               ó$   € V ^8„  d   QhRRRRRR/# r    r   )r   s   "r   r   rh   H  r¡   r   c                óJ   € V P                   ! \        P                  V3/ VB  R# )a¨  
Emit a log event at log level L{LogLevel.error}.

@param format: a message format using new-style (PEP 3101) formatting.
    The logging event (which is a L{dict}) is used to render this
    format string.

@param kwargs: additional key/value pairs to include in the event.
    Note that values which are later mutated may result in
    non-deterministic behavior from observers that schedule work for
    later execution.
N)r™   r   Úerrorr¤   s   &&,r   r³   ÚLogger.errorH  r¦   r   c               ó$   € V ^8„  d   QhRRRRRR/# r    r   )r   s   "r   r   rh   W  s!   € ÷ 7ñ 7˜}ð 7¸vð 7È$ñ 7r   c                óJ   € V P                   ! \        P                  V3/ VB  R# )a«  
Emit a log event at log level L{LogLevel.critical}.

@param format: a message format using new-style (PEP 3101) formatting.
    The logging event (which is a L{dict}) is used to render this
    format string.

@param kwargs: additional key/value pairs to include in the event.
    Note that values which are later mutated may result in
    non-deterministic behavior from observers that schedule work for
    later execution.
N)r™   r   Úcriticalr¤   s   &&,r   r·   ÚLogger.criticalW  s   € ð 	�	Š	”(×#Ñ# VÑ6¨vÔ6r   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   r   rg   r‰   r   rŠ   ry   r   zContextManager[Operation]r   )r   s   "r   r   rh   f  s2   € ÷ *Oñ *OØð*OØ"*ð*OØJPð*Oà	"ñ*Or   c                ó.   a aaa€ \        VVVV 3R l4      # )a?  
Run some application code, logging a failure and emitting a traceback
in the event that any of it fails, but continuing on.  For example::

    log = Logger(...)

    def frameworkCode() -> None:
        with log.failuresHandled("While frobbing {knob}:", knob=knob) as op:
            frob(knob)
        if op.succeeded:
            log.info("frobbed {knob} successfully", knob=knob)

This method is meant to capture unexpected exceptions from application
code; an exception that is caught and handled somehow should be logged,
if appropriate, via L{Logger.error} instead.  If some unknown exception
occurs and your code doesn't know how to handle it, as in the above
example, then this method provides a means to describe the failure.
This is done at L{LogLevel.critical} by default, since no corrective
guidance can be offered to an user/administrator, and the impact of the
condition is unknown.

@param format: a message format using new-style (PEP 3101) formatting.
    The logging event (which is a L{dict}) is used to render this
    format string.

@param level: a L{LogLevel} to use.

@param kwargs: additional key/value pairs to include in the event, if
    it is emitted.  Note that values which are later mutated may result
    in non-deterministic behavior from observers that schedule work for
    later execution.

@see: L{Logger.failure}
@see: L{Logger.failureHandler}

@return: A context manager which yields an L{Operation} which will have
    either its C{succeeded} or C{failed} attribute set to C{True} upon
    completion of the code within the code within the C{with} block.
c                ó.   <€ SP                   ! SV S3/ SB # r=   rF   )Úfr   rŠ   r‰   r    s   &€€€€r   Ú<lambda>Ú(Logger.failuresHandled.<locals>.<lambda>�  s   ø€  T§\¢\°&¸!¸UÑ%MÀfÒ%Mr   )r5   )r    r   r‰   rŠ   s   ffflr   ÚfailuresHandledÚLogger.failuresHandledf  s   û€ ôT ×MÓNÐNr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   ÚstaticMessagerg   r‰   r   r   zContextManager[None]r   )r   s   "r   r   rh   ’  s-   € ÷ +Pñ +Pàð+Pð ð+Pð 
ñ	+Pr   c                ó*   a aa€ \        VV V3R l4      # )aÂ  
For performance-sensitive frameworks that needs to handle potential
failures from frequently-called application code, and do not need to
include detailed structured information about the failure nor inspect
the result of the operation, this method returns a context manager that
will log exceptions and continue, that can be shared across multiple
invocations.  It should be instantiated at module scope to avoid
additional object creations.

For example::

    log = Logger(...)
    ignoringFrobErrors = log.failureHandler("while frobbing:")

    def hotLoop() -> None:
        with ignoringFrobErrors:
            frob()

This method is meant to capture unexpected exceptions from application
code; an exception that is caught and handled somehow should be logged,
if appropriate, via L{Logger.error} instead.  If some unknown exception
occurs and your code doesn't know how to handle it, as in the above
example, then this method provides a means to describe the failure in
nerd-speak.  This is done at L{LogLevel.critical} by default, since no
corrective guidance can be offered to an user/administrator, and the
impact of the condition is unknown.

@param format: a message format using new-style (PEP 3101) formatting.
    The logging event (which is a L{dict}) is used to render this
    format string.

@param level: a L{LogLevel} to use.

@see: L{Logger.failure}

@return: A context manager which does not return a value, but will
    always exit from exceptions.
c                ó*   <€ SP                  SV S4      # r=   rF   )r¼   r‰   r    rÂ   s   &€€€r   r½   Ú'Logger.failureHandler.<locals>.<lambda>½  s   ø€ ¨¯©°mÀQÈÔ)Nr   )rX   )r    rÂ   r‰   s   fffr   ÚfailureHandlerÚLogger.failureHandler’  s   ú€ ôV ÖNÓOÐOr   )ro   rr   rq   )NNNr=   )r-   r.   r/   r0   r1   Ústaticmethodrl   rA   r   r†   r™   r   r·   r'   r£   rª   r¯   r³   r¿   rÆ   r3   r   r   r   rd   rd   f   s‰   † ñð ô	ó ð	÷%÷:
õ@A÷%ðT &*Ø"×+Ñ+÷	5@÷n4÷3÷3÷4÷7ð  .6×->Ñ->÷*Oð^ #×+Ñ+÷+Pó +Pr   rd   c               ó    € V ^8„  d   QhRRRR/# )r   Úobjry   r   rd   r   )r   s   "r   r   r   Ã  s   € ÷ ,ñ ,�Fð ,˜vñ ,r   c                ó@   € \         P                  W P                  4      # )z7
Get a L{Logger} instance attached to the given class.
)Ú_logr   r}   )rÊ   s   &r   Ú
_loggerForrÍ   Ã  s   € ô �<‰<˜Ÿ]™]Ó+Ð+r   N)r1   Ú
__future__r   r   Útypesr   Útypingr   r   r   r   r	   r
   Útwisted.python.compatr   Útwisted.python.failurer   Ú_interfacesr   r   Ú_levelsr   r   r   r5   rX   rd   rÌ   rÍ   r   r   r   Ú<module>rÕ      sd   ðñ
õ #å Ý ß J× Jå .Ý *ß /ß 3ô�ô ÷<ñ ÷<ñ ÷*WPñ WPñt
 ƒx€÷,r   