A Aspect to log request process for vrml library
<dependency>
<groupId>group.rxcloud</groupId>
<artifactId>vrml-api</artifactId>
<version>1.1.4</version>
</dependency>
Use LogsAPI
Provides configurable logging function based on Logs
module.
The format of the Api
aspect key is [className.methodName].
extends AbstractApiLogInterceptorAspect
and register to bean with `@Aspect.
Implement various hook methods.
/**
* The Api log interceptor aspect test.
*/
public class ApiLogInterceptorAspectTest {
/**
* The num will be add by aspect.
*/
public static int num = 0;
/**
* The Test api log interceptor aspect.
* All aspect methods will add the num.
*/
@Aspect
@Component
public static class TestApiLogInterceptorAspect extends AbstractApiLogInterceptorAspect {
@Override
public Object requestInvoker(ProceedingJoinPoint pjp) throws Throwable {
ApiLogInterceptorAspectTest.num++;
return super.requestInvoker(pjp);
}
@Override
protected boolean isDoBefore(ProceedingJoinPoint pjp) {
ApiLogInterceptorAspectTest.num++;
return super.isDoBefore(pjp);
}
@Override
protected void doBefore(ProceedingJoinPoint pjp) {
ApiLogInterceptorAspectTest.num++;
super.doBefore(pjp);
}
@Override
protected boolean isDoAfter(ProceedingJoinPoint pjp, Object proceed) {
ApiLogInterceptorAspectTest.num++;
return super.isDoAfter(pjp, proceed);
}
@Override
protected void doAfter(ProceedingJoinPoint pjp, Object proceed) {
ApiLogInterceptorAspectTest.num++;
super.doAfter(pjp, proceed);
}
@Override
public boolean isDoException(ProceedingJoinPoint pjp, Throwable throwable) {
ApiLogInterceptorAspectTest.num++;
return super.isDoException(pjp, throwable);
}
@Override
public Object doException(ProceedingJoinPoint pjp, Throwable throwable) throws Throwable {
ApiLogInterceptorAspectTest.num++;
return super.doException(pjp, throwable);
}
}
/**
* The Test server api.
*/
@ApiLogInterceptor
@Component
public static class TestServerApi {
/**
* Server api func.
*/
public String api(String args) {
return "args:" + args;
}
}
/**
* The Test client.
*/
@Component
public static class TestClient {
@Autowired
private TestServerApi testServerApi;
/**
* Call api.
*/
public void call() {
System.out.println(testServerApi.api("hello"));
}
}
@Autowired
private TestClient testClient;
/**
* Test.
*/
public void test() {
testClient.call();
}
}
Developer repository can be found here.
- Add eventbus listener
- Statistics start and end time
<dependency>
<groupId>group.rxcloud</groupId>
<artifactId>vrml-api</artifactId>
<version>1.1.4</version>
</dependency>
A small number of users have reported problems building vrml. Read our contribution guide for details.