import time
import logging


def timed_func(process_name):
    """
    Adds printed time output for a function
    Will print out the time the function took as well as label this output with process_name

    :param process_name: human name of the process being timed
    """
    def decorator(f):
        def wrapper(*args, **kwargs):
            start = time.time()
            ret = f(*args, **kwargs)
            logging.getLogger("").info("Elapsed time for {}: {}".format(process_name, time.time()-start))
            return ret
        return wrapper
    return decorator