idea一键生成Log日志
通过idea live templates自动生成:
1、loge 异常日志打印
log.error($content$,$[params](https://so.csdn.net/so/search?q=params&spm=1001.2101.3001.7020)$);
content 参数:
groovyScript("def params = _2.collect {'【'+it+' = {}】'}.join(', '); return '\"' + _1 + '() called with exception => ' + (params.empty ? '' : params) + '\"'", methodName(), methodParameters())
params参数:
groovyScript("def params = _1.collect {it}.join(', '); return (params.empty ? '' : params) + ',e' ", methodParameters())
微信截图_20220621175939.png
2、logi 参数日志打印
log.info($content$,$params$);
content参数:
groovyScript("def params = _2.collect {'【'+it+' = {}】'}.join(', '); return '\"' + _1 + '() called with parameters => ' + (params.empty ? '' : params) + '\"'", methodName(), methodParameters())
params参数:
groovyScript("def params = _1.collect {it}.join(', '); return (params.empty ? '' : params) ", methodParameters())
3、logr 结果日志打印
log.info("$METHOD_NAME$() returned: " + $result$);
METHOD_NAME参数:
methodName()
result参数:
variableOfType(methodReturnType())
网友评论