Created
December 5, 2014 21:59
-
-
Save nohitme/410d689535c49938ca11 to your computer and use it in GitHub Desktop.
Groovy Script for IntellJ LiveTemplates to generate log statement with method name and paramters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
groovyScript(" | |
def method = _1; | |
def arguments = _2; | |
if (_2.isEmpty()) { | |
return 'LOGGER.i(\"[' + method + ']\");'; | |
}; | |
def result = 'LOGGER.iFormat(\"[' + method + ']: '; | |
def args = []; | |
arguments.each { | |
args << it.toUpperCase() + ': %s'; | |
}; | |
result += args.join(', '); | |
result += '\", ' + arguments.join(', ') + ');'; | |
return result; | |
", methodName(), methodParameters()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment