
    3jW                     P   S r SSKrSSKrSSKJrJr  \R                  rS r\	" \5      \R                  l        \R                  R                  \R                  l        \R                  \R                  l        \R                  \R                  l        \R                  \R                  l        \R                   =\R                  l        \R                  l        \(       a!  \" S5      R%                  \R                  5         " S S\5      r " S S	\5      r " S
 S\5      rS rg)zFix missing-API problems in logging module (circa Python 2.3)

Adds constants to the log objects.
Adds getException(err) to log objects to retrieve 
formatted exception or err if traceback not available.
    N)ERROR_LOGGINGFULL_LOGGINGc                 p     [         R                  " SS9$ ! [         a  n[        U 5      s SnA$ SnAff = f)z&Get formatted traceback from exception
   )limitN)	traceback
format_exc	Exceptionstr)errorerrs     E/home/wildlama/miniconda3/lib/python3.13/site-packages/OpenGL/logs.pygetExceptionr      s2    ##2// E|s    
5
055OpenGL.calltracec                   *    \ rS rSrSrS rS rS rSrg)_LoggedFunction   z.Proxy that overrides __call__ to log argumentsc                 <    XR                   S'   X R                   S'   g )N log)__dict__)selfbaser   s      r   __init___LoggedFunction.__init__   s     b"e    c                 `    US:w  a  [        U R                  S   X5        g X R                  S'   g Nr   )setattrr   )r   keyvalues      r   __setattr___LoggedFunction.__setattr__!   s(    "9T]]2&4 %MM"r   c                 ^    US:X  a  U R                   S   $ [        U R                   S   U5      $ r   )r   getattr)r   r    s     r   __getattr___LoggedFunction.__getattr__&   s.    "9==$$DMM"-s44r    N)	__name__
__module____qualname____firstlineno____doc__r   r"   r&   __static_attributes__r(   r   r   r   r      s    8#&
5r   r   c                   .    \ rS rSrSr\" S5      rS rSrg)_FullLoggedFunction+   zHFully-logged function wrapper (logs all call params to OpenGL.calltrace)r   c                     / n[        U S5      nU H  nUR                  [        U5      5        M     UR                  5        H&  u  pgUR                  U< S[        U5      < 35        M(     SR	                  U5      nU R
                  R                  SUR                  U5         U" U0 UD6$ ! [         aF  nU R                  R                  SUR                  U R                  R                  U5      5        e S nAff = f)Nr   z = ,z%s( %s )Failure on %s: %s)r%   appendrepritemsjoin
_callTraceinfor)   r
   r   warningr   )	r   argsnamedargReprfunctionargr    r!   r   s	            r   __call___FullLoggedFunction.__call__.   s    D"&CNNDI' ICNNDK8: '((G%j(*;*;WF	d-e-- 	HH'):):DHH<Q<QSV<X 		s   %B- -
C=7AC88C=r(   N)	r)   r*   r+   r,   r-   getLogr9   rA   r.   r(   r   r   r0   r0   +   s    R+-Jr   r0   c                       \ rS rSrSrS rSrg)_ErrorLoggedFunction>   z On-error-logged function wrapperc                     [        U S5      n U" U0 UD6$ ! [         aF  nU R                  R                  SUR                  U R                  R                  U5      5        e S nAff = f)Nr   r4   )r%   r
   r   r;   r)   r   )r   r<   r=   r?   r   s        r   rA   _ErrorLoggedFunction.__call__@   sg    D"&	d-e-- 	HH'):):DHH<Q<QSV<X 		s    
A&AA!!A&r(   N)r)   r*   r+   r,   r-   rA   r.   r(   r   r   rE   rE   >   s
    *r   rE   c                 |    [         (       d  [        (       a%  [        (       a  [        X5      nU$ [        X5      nU$ U $ )zProduce possible log-wrapped version of function

function -- callable object to be wrapped
log -- the log to which to log information

Uses ERROR_LOGGING and FULL_LOGGING
to determine whether/how to wrap the function.
)r   r   r0   rE   )r?   r   loggedFunctions      r   	logOnFailrK   K   s;     }<0(AN  28BNr   )r-   r   loggingOpenGL._configflagsr   r   	getLoggerrC   r   staticmethodLoggerr   r   DEBUGWARNINFOERRORERRsetLevelobjectr   r0   rE   rK   r(   r   r   <module>rX      s     ;			 +L: ^^)) }} ll ll ,3MM 9 W^^)
 ))7<<95v 5? &
_ 
r   