Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@Rajin9601 Rajin9601 commented Apr 27, 2020

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