
    )Jf                     (    d Z ddlZddlZddlZd ZdS )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                 J     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 #                       dd                    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     X/home/alex/cs2snipeproduction/venv/lib/python3.11/site-packages/pika/diagnostic_utils.pylog_exception_func_wrapzVcreate_log_exception_decorator.<locals>.log_exception.<locals>.log_exception_func_wrap(   sf    tT,V,,,  NGGI6GHHJ J J s
    A	A)	functoolswraps)r   r   r   s   ` r   log_exceptionz5create_log_exception_decorator.<locals>.log_exception    sA     
			 	 	 	 	 
		& '&     )r   r   s   ` r   create_log_exception_decoratorr   
   s$    ,' ' ' ' '< r   )__doc__r   r   r	   r   r   r   r   <module>r      sK         



    4 4 4 4 4r   