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+= params[i] + ((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(paramTypes[i].replace('java.lang.',''))){ result+=params[i] + ((i < params.size() - 1) ? ', ' : ''); }else{ result+='JSONObject.toJSONString(' + params[i] + ((i < params.size() - 1) ? '), ' : ')'); } }; return result; " , methodParameters(), methodParameterTypes())

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

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

methodName:methodName()

result:variableOfType(Type)

相关推荐
一眼万里*e2 分钟前
搭建个人知识库
python
Mr.Ma.0114 分钟前
解决Idea 插件Plantuml4idea找不到dot的问题
intellij-idea
q***649721 分钟前
Spring BOOT 启动参数
java·spring boot·后端
百***784524 分钟前
Java实战:Spring Boot application.yml配置文件详解
java·网络·spring boot
你不是我我33 分钟前
【Java 开发日记】SQL 语句左连接右连接内连接如何使用,区别是什么?
java·javascript·数据库
程序员小远41 分钟前
软件测试之bug分析定位技巧
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·bug
七夜zippoe1 小时前
Java性能调优工具篇:JMH基准测试与Profiler(JProfiler/Async-Profiler)使用指南
java·开发语言·jprofiler·jmh·async-profiler
從南走到北1 小时前
JAVA国际版二手车交易二手车市场系统源码支持Android+IOS+H5+APP
android·java·ios
江上清风山间明月1 小时前
Android 系统中进程和线程的区别
android·python·线程·进程
Kuo-Teng1 小时前
LeetCode 19: Remove Nth Node From End of List
java·数据结构·算法·leetcode·链表·职场和发展·list