def log_on_crash(func):
    '''
    This is a decorator that can be used to log any exceptions that occur in a function.
    This is mainly intended to wrap around the main() functions/entrypoints to durdraw,
    so that any exceptions that occur can be logged to a file for debugging or support.
    '''
    logger = getLogger('crash', level='ERROR')
    @wraps(func)
    def inner(*args, **kwargs):
        # run the function, return the result, and log any exceptions
        try:
            return func(*args, **kwargs)
        except Exception as e:
            logger.exception(
                'durview crashed',
                {'class': e.__class__.__name__, 'message': str(e)},
                exc_info=True,
            )
            raise e
    return inner

    This is a decorator that can be used to log any exceptions that occur in a function.
    This is mainly intended to wrap around the main() functions/entrypoints to durdraw,
    so that any exceptions that occur can be logged to a file for debugging or support.
    
durdraw/log.py