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