| | |
| | | import com.iailab.module.infra.api.logger.ApiAccessLogApi; |
| | | import com.iailab.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | |
| | | /** |
| | |
| | | * @author iailab |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Slf4j |
| | | public class ApiAccessLogFrameworkServiceImpl implements ApiAccessLogFrameworkService { |
| | | |
| | | private final ApiAccessLogApi apiAccessLogApi; |
| | |
| | | @Override |
| | | @Async |
| | | public void createApiAccessLog(ApiAccessLogCreateReqDTO reqDTO) { |
| | | apiAccessLogApi.createApiAccessLog(reqDTO); |
| | | try { |
| | | apiAccessLogApi.createApiAccessLog(reqDTO); |
| | | } catch (Throwable ex) { |
| | | // 由于 @Async 异步调用,这里打印下日志,更容易跟进 |
| | | log.error("[createApiAccessLog][url({}) log({}) 发生异常]", reqDTO.getRequestUrl(), reqDTO, ex); |
| | | } |
| | | } |
| | | |
| | | } |