import time
import logging

def logging_time(logger: logging.Logger=None):
    if logger is None:
        logger = logging.getLogger("unknown_logger")
    def dec(cb):
        def inner(self, *args, **kwargs):
            start = time.time()
            result = cb(self, *args, **kwargs)
            end = time.time()
            logger.info(self.__class__.__name__+"."+cb.__name__ + " Time taken: " + str(end - start) + " seconds")
            return result
        return inner
    return dec