Skip to content

Instantly share code, notes, and snippets.

@nohitme
Created December 5, 2014 21:59
Show Gist options
  • Save nohitme/410d689535c49938ca11 to your computer and use it in GitHub Desktop.
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
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