
    f                     &    d Z ddlZddlZddlZd Zy)z
Diagnostic utilities
    Nc                       fd}|S )a  Create a decorator that logs and reraises any exceptions that escape
    the decorated function

    :param logging.Logger logger:
    :returns: the decorator
    :rtype: callable

    Usage example

    import logging

    from pika.diagnostics_utils import create_log_exception_decorator

    _log_exception = create_log_exception_decorator(logging.getLogger(__name__))

    @_log_exception
    def my_func_or_method():
        raise Exception('Oops!')

    c                 F     t        j                          fd       }|S )zThe decorator returned by the parent function

        :param func: function to be wrapped
        :returns: the function wrapper
        :rtype: callable
        c            
          	  | i |S #  j                  ddj                  t        j                  t	        j
                                        xY w)a  The wrapper function returned by the decorator. Invokes the
            function with the given args/kwargs and returns the function's
            return value. If the function exits with an exception, logs the
            exception traceback and re-raises the

            :param args: positional args passed to wrapped function
            :param kwargs: keyword args passed to wrapped function
            :returns: whatever the wrapped function returns
            :rtype: object
            z6Wrapped func exited with exception. Caller's stack:
%s )	exceptionjoin	tracebackformat_exceptionsysexc_info)argskwargsfuncloggers     P/var/www/cs2snipe.com/venv/lib/python3.12/site-packages/pika/diagnostic_utils.pylog_exception_func_wrapzVcreate_log_exception_decorator.<locals>.log_exception.<locals>.log_exception_func_wrap(   sS    T,V,,  NGGI66GHJ s
    AA)	functoolswraps)r   r   r   s   ` r   log_exceptionz5create_log_exception_decorator.<locals>.log_exception    s(     
		 
	& '&     )r   r   s   ` r   create_log_exception_decoratorr   
   s    ,'< r   )__doc__r   r   r	   r   r   r   r   <module>r      s     
 4r   