import logging
import time


def RunTime(func):
    def wrapper(*args, **kwargs):
        t1 = time.time()
        res = func(*args, **kwargs)
        t2 = time.time()
        if t2 - t1 > 0.05:
            logging.info(f"function：【{func.__name__}】,runtime：【{str(t2 - t1)}】s")
        # logging.info(f"function：【{func.__name__}】,runtime：【{str(t2 - t1)}】s")
        return res

    return wrapper


def ClassCallRunTime(func):
    def wrapper(*args, **kwargs):
        start_time = time.time()
        result = func(*args, **kwargs)
        end_time = time.time()
        execution_time = end_time - start_time
        class_name = args[0].__class__.__name__  # 获取类名
        if execution_time > 0.05:
            logging.info(f"class name: {class_name} , run time is : {execution_time} s")
        return result

    return wrapper
