refactor(logging): 重构执行时间统计功能的注解和切面类命名

This commit is contained in:
2026-02-25 16:00:15 +08:00
parent 870e9ba8a8
commit 6d486c5ba6
4 changed files with 106 additions and 106 deletions
@@ -31,7 +31,7 @@ import java.lang.annotation.Target;
@Documented
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface ExecutionTimeStatisticsFace {
public @interface ExecutionTimeLog {
/**
* 接口描述
@@ -32,20 +32,20 @@ import org.springframework.stereotype.Component;
@Slf4j
@Aspect
@Component
public class ExecutionTimeStatisticsFaceAspect {
public class ExecutionTimeLogAspect {
@Around("@annotation(executionTimeStatisticsFace)")
public Object aroundFace(ProceedingJoinPoint joinPoint, ExecutionTimeStatisticsFace executionTimeStatisticsFace)
@Around("@annotation(executionTimeLog)")
public Object aroundFace(ProceedingJoinPoint joinPoint, ExecutionTimeLog executionTimeLog)
throws Throwable {
TimeInterval timeInterval = new TimeInterval();
try {
Object proceed = joinPoint.proceed();
log.info("[{}] 接口执行成功,耗时: {} ms", executionTimeStatisticsFace.description(),
log.info("[{}] 接口执行成功,耗时: {} ms", executionTimeLog.description(),
timeInterval.intervalMs());
return proceed;
} catch (Exception e) {
if (executionTimeStatisticsFace.showErrLog()) {
log.error("[{}] 接口执行失败,耗时: {} ms", executionTimeStatisticsFace.description(),
if (executionTimeLog.showErrLog()) {
log.error("[{}] 接口执行失败,耗时: {} ms", executionTimeLog.description(),
timeInterval.intervalMs(), e);
}
throw e;