
    Cj                     B    S r SSKrSSKJrJr  SSKJr   " S S\5      rg)z
A Textual Logging handler.

If there is an active Textual app, then log messages will go via the app (and logged via textual console).

If there is *no* active app, then log messages will go to stderr or stdout, depending on configuration.
    N)Handler	LogRecord)
active_appc                   R   ^  \ rS rSrSrSS\S\SS4U 4S jjjrS\SS4S	 jrS
r	U =r
$ )TextualHandler   z#A Logging handler for Textual apps.stderrstdoutreturnNc                 :   > [         TU ]  5         Xl        X l        g)zInitialize a Textual logging handler.

Args:
    stderr: Log to stderr when there is no active app.
    stdout: Log to stdout when there is no active app.
N)super__init___stderr_stdout)selfr	   r
   	__class__s      a/home/rurouni/.local/share/pipx/venvs/strix-agent/lib/python3.13/site-packages/textual/logging.pyr   TextualHandler.__init__   s     	    recordc                 T   U R                  U5      n [        R                  " 5       nUR                  R	                  U5        g! [
         aY    U R                  (       a  [        U[        R                  S9   gU R                  (       a  [        U[        R                  S9   g gf = f)zInvoked by logging.)fileN)formatr   getlogloggingLookupErrorr   printsysr	   r   r
   )r   r   messageapps       r   emitTextualHandler.emit   ss    ++f%	%.."C GGOOG$  	0||gCJJ/gCJJ/ 	0s   A 3B'9)B'&B')r   r   )TF)__name__
__module____qualname____firstlineno____doc__boolr   r   r"   __static_attributes____classcell__)r   s   @r   r   r      s=    -	t 	D 	T 	 	%9 % % %r   r   )r(   r   r   r   r   textual._contextr   r    r   r   <module>r.      s!     & '%W %r   