Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Rajin9601/61bb1645cb9bb0c4837ba3f0f24ec1e9 to your computer and use it in GitHub Desktop.
Save Rajin9601/61bb1645cb9bb0c4837ba3f0f24ec1e9 to your computer and use it in GitHub Desktop.
intellij live template for kotlin function logging
  1. create a live template (I use logf for log function)

  2. fill template text with

android.util.Log.i("$tag$", "$content$")
  1. click edit variables and type in expression for the variables

tag :

groovyScript("_1 ?: '<top>'", kotlinClassName())

content :

groovyScript("def name = _1;def params = _2.collect {it + ' = [$' + it + ']'}.join(', ');return name + '() called' + (params.empty ? '' : ' with: ' + params)", kotlinFunctionName(),functionParameters())
  1. check "Skip if defined" for all variables

  2. click Define next to "No applicable contexts" and check Kotlin - Statement

@Rajin9601
Copy link
Author

Screen Shot 2020-04-27 at 11 07 46 AM
Screen Shot 2020-04-27 at 11 08 23 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment