Idea配置LiveTemplate实现日志快捷输出
1 | log.info($content$,$params$); |
content参数:
1 | groovyScript("def params = _2.collect {'【'+it+' = {}】'}.join(', '); return '\"' + _1 + '() called with parameters => ' + (params.empty ? '' : params) + '\"'", methodName(), methodParameters()) |
params参数:
1 | groovyScript("def params = _1.collect {it}.join(', '); return (params.empty ? '' : params) ", methodParameters()) |
2、logr 结果日志打印
1 | log.info("$METHOD_NAME$() returned: " + $result$); |
METHOD_NAME参数:
1 | methodName() |
result参数:
1 | variableOfType(methodReturnType()) |
3、loge 异常日志打印
1 | log.error($content$,$params$); |
content 参数:
1 | groovyScript("def params = _2.collect {'【'+it+' = {}】'}.join(', '); return '\"' + _1 + '() called with exception => ' + (params.empty ? '' : params) + '\"'", methodName(), methodParameters()) |
params参数:
1 | groovyScript("def params = _1.collect {it}.join(', '); return (params.empty ? '' : params) + ',e' ", methodParameters()) |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Toweringx的博客!
评论