utils/__init__.py
def log_exceptions(exit_on_exception=False):
    """
    Logs any exceptions raised.

    By default, exceptions are then re-raised. If set to exit on exception,
    sys.exit(1) is called instead.
    """

    def decorator(func):

        @functools.wraps(func)
        def wrapper(*args, **kwargs):
            try:
                return func(*args, **kwargs)
            except Exception:
                if exit_on_exception:
                    log.exception('Unrecoverable exception encountered. Exiting.')
                    sys.exit(1)
                else:
                    log.exception('Exception encountered.')
                    raise

        return wrapper

    return decorator

    Logs any exceptions raised.

    By default, exceptions are then re-raised. If set to exit on exception,
    sys.exit(1) is called instead.
    
Logs any exceptions raised.
By default, exceptions are then re-raised. If set to exit on exception,
sys.exit(1) is called instead.
Logs any exceptions raised . By default exceptions are then re - raised . If set to exit on exception sys . exit ( 1 ) is called instead .
def log_exceptions(exit_on_exception=False):
    def decorator(func):
        @functools.wraps(func)
        def wrapper(*args, **kwargs):
            try:
                return func(*args, **kwargs)
            except Exception:
                if exit_on_exception:
                    log.exception('Unrecoverable exception encountered. Exiting.')
                    sys.exit(1)
                else:
                    log.exception('Exception encountered.')
                    raise
        return wrapper
    return decorator
def log_exceptions ( exit_on_exception = False ) : def decorator ( func ) : @ functools . wraps ( func ) def wrapper ( * args , ** kwargs ) : try : return func ( * args , ** kwargs ) except Exception : if exit_on_exception : log . exception ( 'Unrecoverable exception encountered. Exiting.' ) sys . exit ( 1 ) else : log . exception ( 'Exception encountered.' ) raise return wrapper return decorator
Logs any exceptions raised.
Logs any exceptions raised .
"""
    Logs any exceptions raised.

    By default, exceptions are then re-raised. If set to exit on exception,
    sys.exit(1) is called instead.
    """
exit_on_exception