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)

相关推荐
程序员龙叔11 小时前
编写高质量 Skill 系列 -- 如何设计需求分析与用例生成的 SKILL
自动化测试·软件测试·python·软件测试工程师·接口测试·性能测试·skill·ai测试
NE_STOP14 小时前
Vide Coding--AI编程工具的选择
java
用户83562907805114 小时前
使用 Python 操作 Word 内容控件
后端·python
码云数智-园园14 小时前
C++20 Modules 模块详解
java·开发语言·spring
程序员黑豆14 小时前
JDK 下载安装与配置详细教程
java·前端·ai编程
小宇宙Zz15 小时前
Maven依赖冲突
java·服务器·maven
swordbob15 小时前
NIO的channel中什么是 fd(File Descriptor,文件描述符)
java·开发语言·nio
咖啡八杯15 小时前
GoF设计模式——享元模式
java·spring·设计模式·享元模式
十五喵源码网15 小时前
基于springboot2+vue2的租房管理系统
java·毕业设计·springboot·论文笔记