package com.common.lib_base.aop.aspectj;

import android.util.Log;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;

/**
 * Date: 2022/5/17 0017 10:21
 * Description:
 */
@Aspect
public class TimeAspect {

//    private static final String TAG = "Aspect";
//
//    /**
//     * 进行一个切点
//     * 注解的包名路径，此处建议Copy Reference
//     */
//    @Pointcut("execution(@com.common.lib_base.aop.annotation.Time * *(..))")
//    public void pointActionMethod() {
//
//    }
//
//    /**
//     * 进行切面的处理
//     * 填写切点的方法名，注意带上()
//     *
//     * @param proceedingJoinPoint
//     * @throws Throwable
//     */
//    @Around("pointActionMethod()")
//    public void methodTime(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
//
//        Log.i(TAG, "TimeAspect--begin--");
//        Signature signature = proceedingJoinPoint.getSignature();
//        String name = signature.toShortString();
//        long time = System.currentTimeMillis();
//        try {
//            proceedingJoinPoint.proceed();
//        } catch (Throwable throwable) {
//            throwable.printStackTrace();
//        }
//        Log.i(TAG, "TimeAspect--methodTime--" + name + " cost " + (System.currentTimeMillis() - time));
////        LogUtils.e("Aspect--methodTime--" + name + " cost " + (System.currentTimeMillis() - time));
//    }

}
