Idea live template

1:打印入参日志的配置

复制代码
log.info("$methodName$ 方法入参: $argsLog$",$argsJson$);

methodName:methodName()

argsLog:groovyScript( "def result=''; def params=\"${_1}\".replaceAll('\\\\\\\\\[\|\\\\\\\\|\\\\s]', '').split(',').toList(); for(i = 0; i < params.size(); i++) { result+= paramsi + ((i < params.size() - 1) ? ':{}, ' : ':{}') }; return result" , methodParameters())

argsJson:groovyScript(" def result=''; def types = 'String,int,Integer,long,Long,float,Float,double,Double,byte,Byte,short,Short,char,Char,boolean,Boolean'; def params=\"{_1}\\".replaceAll('\[\\\\\\\\\[\|\\\\\\\\\]\|\\\\\\\\s\]','').split(',').toList(); def paramTypes=\\"{_2}\".replaceAll('\\\\\\\\\[\|\\\\\\\\|\\\\s]','').split(',').toList(); for(i = 0; i < params.size(); i++) { if(types.contains(paramTypesi.replace('java.lang.',''))){ result+=paramsi + ((i < params.size() - 1) ? ', ' : ''); }else{ result+='JSONObject.toJSONString(' + paramsi + ((i < params.size() - 1) ? '), ' : ')'); } }; return result; " , methodParameters(), methodParameterTypes())

2、打印返回结果日志的配置

复制代码
log.info("$METHOD_NAME$() returned: {}" ,  $result$);

methodName:methodName()

result:variableOfType(Type)

相关推荐
小羊没烦恼!1 天前
微服务化的基石——持续集成
java·大数据·word·powerpoint·.net
默_笙1 天前
🍙 给每个请求过安检:FastAPI 是怎么把校验写进类型注解的
python
俊昭喜喜里1 天前
java中的继承和多态的区别
java
小羊没烦恼!1 天前
初探性能优化——2个月到4小时的性能提升
java·开发语言·windows·算法·c#
qq_426003961 天前
启动playwright录制codegen生成自动化测试脚本
python·自动化
譕痕1 天前
JSONObject与JSONArray封装数据格式区别
java·json
虎头金猫1 天前
4K 视频总卡在公网带宽?用 N1 + OpenList 把网盘播放链路重新理顺
运维·服务器·网络·python·容器·beautifulsoup·pandas
胡写代码1 天前
别再前后端各写一套表单校验了
java·后端
小鱼能吃糖1 天前
缺陷修复总览 · mall电商项目:5类缺陷,1个病根,4个业务域
java·电商
长沙三为智能科技1 天前
家政小程序开发从0到上线:五阶段交付流程与验收清单
python