Created
March 17, 2020 11:50
-
-
Save martynhaigh/8cf2e7d07993aca6f938ffac5c3a2405 to your computer and use it in GitHub Desktop.
Android Studio Timber Live Templates Kotlin
This file contains 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
<templateSet group="TimberKotlin"> | |
<template name="timm" value="timber.log.Timber.d($FORMAT$)" description="Log method name and its arguments" toReformat="true" toShortenFQNames="true"> | |
<variable name="FORMAT" expression="groovyScript("def params = _2.collect {it + ' = [$' + it + ']'}.join(', '); return '\"' + _1 + '() called' + (params.empty ? '' : ' with: ' + params) + '\"'", kotlinFunctionName(), functionParameters())" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="KOTLIN_STATEMENT" value="true" /> | |
</context> | |
</template> | |
<template name="timd" value="timber.log.Timber.d("$METHOD_NAME$: $content$")" description="Timber.d(String)" toReformat="true" toShortenFQNames="true"> | |
<variable name="METHOD_NAME" expression="kotlinFunctionName()" defaultValue="" alwaysStopAt="false" /> | |
<variable name="content" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="KOTLIN_STATEMENT" value="true" /> | |
</context> | |
</template> | |
<template name="time" value="timber.log.Timber.e($exception$, "$METHOD_NAME$: $content$")" description="Timber.e(Exception, String)" toReformat="true" toShortenFQNames="true"> | |
<variable name="exception" expression="" defaultValue="e" alwaysStopAt="true" /> | |
<variable name="METHOD_NAME" expression="kotlinFunctionName()" defaultValue="" alwaysStopAt="false" /> | |
<variable name="content" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="KOTLIN_STATEMENT" value="true" /> | |
</context> | |
</template> | |
<template name="timi" value="timber.log.Timber.i("$METHOD_NAME$: $content$")" description="Timber.i(String)" toReformat="true" toShortenFQNames="true"> | |
<variable name="METHOD_NAME" expression="kotlinFunctionName()" defaultValue="" alwaysStopAt="false" /> | |
<variable name="content" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="KOTLIN_STATEMENT" value="true" /> | |
</context> | |
</template> | |
<template name="timw" value="timber.log.Timber.w($exception$, "$METHOD_NAME$: $content$")" description="Timber.w(Exception, String)" toReformat="true" toShortenFQNames="true"> | |
<variable name="exception" expression="" defaultValue="e" alwaysStopAt="true" /> | |
<variable name="METHOD_NAME" expression="kotlinFunctionName()" defaultValue="" alwaysStopAt="false" /> | |
<variable name="content" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="KOTLIN_STATEMENT" value="true" /> | |
</context> | |
</template> | |
<template name="timwtf" value="timber.log.Timber.wtf($exception$, "$METHOD_NAME$: $content$")" description="Timber.wtf(Exception, String)" toReformat="true" toShortenFQNames="true"> | |
<variable name="exception" expression="" defaultValue="e" alwaysStopAt="true" /> | |
<variable name="METHOD_NAME" expression="kotlinFunctionName()" defaultValue="" alwaysStopAt="false" /> | |
<variable name="content" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="KOTLIN_STATEMENT" value="true" /> | |
</context> | |
</template> | |
<template name="timmm" value="timber.log.Timber.d($FORMAT$)" description="Log method name and its arguments" toReformat="true" toShortenFQNames="true"> | |
<variable name="FORMAT" expression="groovyScript("def params = _2.collect {it + ' = [$' + it + ']'}.join(', '); return '\"MTEST - ' + _1 + '() called' + (params.empty ? '' : ' with: ' + params) + '\"'", kotlinFunctionName(), functionParameters())" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="KOTLIN_STATEMENT" value="true" /> | |
</context> | |
</template> | |
<template name="timst" value="timber.log.Timber.d($FORMAT$)" description="Log method name and its arguments with calling class name" toReformat="true" toShortenFQNames="true"> | |
<variable name="FORMAT" expression="groovyScript("def params = _2.collect {it + ' = [$' + it + ']'}.join(', '); return '\"MTEST - ' + _1 + '() called' + (params.empty ? '' : ' with: ' + params) + ' called from ${Thread.currentThread().stackTrace[3].className}\"'", kotlinFunctionName(), functionParameters())" defaultValue="" alwaysStopAt="false" /> | |
<context> | |
<option name="KOTLIN_STATEMENT" value="true" /> | |
</context> | |
</template> | |
</templateSet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment