import functools
import time


def process_time(logger):
    """
    Decorator for measuring the ellapsed time for a process.
    The result is logged.
    """
    def decorator_wrapper(func):
        @functools.wraps(func)
        def wrapper_process_time(*args, **kwargs):
            logger.info("Process {} STARTED.".format(func.__name__))
            start_time = time.perf_counter()
            value = func(*args, **kwargs)
            end_time = time.perf_counter()
            logger.info("Process {0} FINISHED. Ellapsed time: {1:.4f}".format(func.__name__, end_time - start_time))
            return value
        return wrapper_process_time
    return decorator_wrapper