+
    Dfjy                         R t ^ RI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 ^RIHtHt ]'       d   ^ RIHt ]! ]4       ! R R	4      4       tR
 R ltR# )z)
Integration with L{twisted.python.log}.
)TYPE_CHECKINGAnyCallableDictOptional)implementer)formatEvent)ILogObserverLogEvent)LogLevel)StringifiableFromEventfromStdlibLogLevelMapping)r	   c                   Z   a  ] tR t^t o RtV 3R lR ltV 3R lR ltV 3R lR ltRtV t	R	# )
LegacyLogObserverWrapperz
L{ILogObserver} that wraps a L{twisted.python.log.ILogObserver}.

Received (new-style) events are modified prior to forwarding to
the legacy observer to ensure compatibility with observers that
expect legacy events.
c                "   < V ^8  d   QhRRRR/# )   legacyObserverILegacyLogObserverreturnN )format__classdict__s   "8/usr/lib/python3/dist-packages/twisted/logger/_legacy.py__annotate__%LegacyLogObserverWrapper.__annotate__    s     - -'; - -    c                    Wn         R# )zZ
@param legacyObserver: a legacy observer to which this observer will
    forward events.
Nr   )selfr   s   &&r   __init__!LegacyLogObserverWrapper.__init__    s
    
 -r   c                    < V ^8  d   QhRS[ /# )r   r   )str)r   r   s   "r   r   r   '   s     T T# Tr   c                &    R P                  V R7      # )z0{self.__class__.__name__}({self.legacyObserver})r   )r   r$   s   &r   __repr__!LegacyLogObserverWrapper.__repr__'   s    AHHdHSSr   c                $   < V ^8  d   QhRS[ RR/# )r   eventr   N)r
   )r   r   s   "r   r   r   *   s     0# 0#h 0#4 0#r   c                N   RV9  d   RVR&   RV9  d   VR,          VR&   RV9  d   VP                  RR4      VR&   RV9  dX   VP                  RR	4      eD   R
VR&   \        VP                  4       4      VR&   \        VR,          \        4      '       g   RVR&   RV9   d6   RV9  d   VR,          VR&   RV9  d   ^VR&   RV9  d   \        V4      VR&   M>RV9  d8   VR,          \        P                  \        P                  39   d   ^VR&   M^ VR&   V P                  V4       R	# )zk
Forward events to the legacy observer after editing them to
ensure compatibility.

@param event: an event
messagetimelog_timesystem
log_system-r   
log_formatNz%(log_legacy)s
log_legacylog_failurefailureisErrorwhy	log_levelr   )
getr   copy
isinstancetupler   r   errorcriticalr   )r   r(   s   &&r   __call__!LegacyLogObserverWrapper.__call__*   s0    E!!E)!*-E&M5 #iic:E(O 5 UYY|T%B%N /E(O"8"FE, eI.66#%i  E!%#(#7i %#$i E!*51ee#[!hnnh6G6G%HH#$i #$i E"r   r   N)
__name__
__module____qualname____firstlineno____doc__r   r%   r=   __static_attributes____classdictcell__)r   s   @r   r   r      s*     - -T T0# 0#r   r   c          	          V ^8  d   QhR\         R\        \        \        3,          R\        \        \        \        3,          .\
        \        ,          3,          RR/# )r   observer	eventDicttextFromEventDictr   N)r	   r   r"   r   r   r   )r   s   "r   r   r   ]   sQ     6 66CH~6  c3h 0(3- ?@6 
	6r   c                   RV9  d   VR,          VR&   RV9  d   V! V4      pVe
   W1R&   RVR&   RV9  dn   RV9   d    \         VR,          ,          pMHR	V9   d2   VR	,          '       d   \        P                  pM!\        P                  pM\        P                  pVe   WAR&   R
V9  d   RVR
&   RV9  d   RV9   d   VR,          VR&   V ! V4       R#   \         d    Rp LGi ; i)a  
Publish an old-style (L{twisted.python.log}) event to a new-style
(L{twisted.logger}) observer.

@note: It's possible that a new-style event was sent to a
    L{LegacyLogObserverWrapper}, and may now be getting sent back to a
    new-style observer.  In this case, it's already a new-style event,
    adapted to also look like an old-style event, and we don't need to
    tweak it again to be a new-style event, hence this checks for
    already-defined new-style keys.

@param observer: A new-style observer to handle this event.
@param eventDict: An L{old-style <twisted.python.log>}, log event.
@param textFromEventDict: callable that can format an old-style event as a
    string.  Passed here rather than imported to avoid circular dependency.
r,   r+   r0   Nlog_textz
{log_text}r6   logLevelr4   log_namespacer1   r.   r-   )r   KeyErrorr   r<   info)rG   rH   rI   textlevels   &&&  r   publishToNewObserverrR   ]   s    , " )& 1	*9$ +$(j!&2Il#)#"1)J2GH )### )) MME%*k"i'%1	/"9$Y)>"+H"5	,Y'  s   C C$#C$N)rC   typingr   r   r   r   r   zope.interfacer   _formatr   _interfacesr	   r
   _levelsr   _stdlibr   r   twisted.python.logr   r   rR   r   r   r   <module>rZ      sO   
 @ ? &   /  FE \C# C# C#L6r   