flyhero / easy-log Goto Github PK
View Code? Open in Web Editor NEWeasy-log是基于SpringBoot的一款通用操作日志组件,它指在帮助我们通过注解优雅地聚合项目中的操作日志,对业务代码无侵入。
License: Apache License 2.0
easy-log是基于SpringBoot的一款通用操作日志组件,它指在帮助我们通过注解优雅地聚合项目中的操作日志,对业务代码无侵入。
License: Apache License 2.0
看文档,非常好用,大力支持👍🏻
目前还没有上传公共仓库吗,目前阿里云仓库搜索不到
com.github.flyhero
easylog-spring-boot-starter
1.0.0
期望不要强制使用SpEL表达式解析,解析不通过直接返回原文
ICustomFunction接口中的executeBefore方法,我理解的是如果为true,说明在拦截的方法执行前会执行apply方法拿到结果并且以这个结果为最终结果返回出去。如果为false,则是在拦截的方法执行后执行apply方法拿到结果。
在下面这个方法逻辑里面,应该就是处理这个事情
/**
* 获取自定义函数值
*
* @param funcValBeforeExecutionMap 执行之前的函数值
* @param funcName 函数名
* @param param 函数参数
* @return
*/
public String getFunctionVal(Map<String, String> funcValBeforeExecutionMap, String funcName, String param) {
String val = null;
if (!CollectionUtils.isEmpty(funcValBeforeExecutionMap)) {
val = funcValBeforeExecutionMap.get(getFunctionMapKey(funcName, param));
}
if (ObjectUtils.isEmpty(val)) {
val = customFunctionService.apply(funcName, param);
}
return val;
}
那下面这个方法就需要调整成这样,否则前后funcValBeforeExecutionMap中的key不一致
public Map<String, String> processBeforeExec(List<String> templates, Method method, Object[] args, Class<?> targetClass) {
HashMap<String, String> map = new HashMap<>();
AnnotatedElementKey elementKey = new AnnotatedElementKey(method, targetClass);
EvaluationContext evaluationContext = cachedExpressionEvaluator.createEvaluationContext(method, args, beanFactory, null, null);
for (String template : templates) {
if (!template.contains("{")) {
continue;
}
Matcher matcher = PATTERN.matcher(template);
while (matcher.find()) {
String param = matcher.group(2);
if (param.contains(EasyLogConsts.POUND_KEY + EasyLogConsts.ERR_MSG) || param.contains(EasyLogConsts.POUND_KEY + EasyLogConsts.RESULT)) {
continue;
}
String funcName = matcher.group(1);
if (customFunctionService.executeBefore(funcName)) {
Object value = cachedExpressionEvaluator.parseExpression(param, elementKey, evaluationContext);
String apply = customFunctionService.apply(funcName, value == null ? null : value.toString());
String paramValue = value == null ? "" : value.toString();
map.put(getFunctionMapKey(funcName, paramValue), apply);
}
}
}
return map;
}
2.1.3 version, cannot be found in the central warehouse
支持不同模块 写入到不同的文件么? 只能默认到公共日志么?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.