Logging¶
Starter Template provides a simple logging utility via the Log object.
You can use it anywhere in your Kotlin code to log messages consistently.
Usage¶
Use the following functions:
You can also pass multiple items:
IDE Live Templates (Recommended)¶
Create live templates in your IDE for faster logging.
Scope: Kotlin
| Abbreviation | Template | Notes |
|---|---|---|
klogd |
com.kmpstarter.utils.logging.Log.d(null,"$FUNNAME$: $MESSAGE$") |
$FUNNAME$ → kotlinFunctionName() |
klogi |
com.kmpstarter.utils.logging.Log.i(null,"$FUNNAME$: $MESSAGE$") |
$FUNNAME$ → kotlinFunctionName() |
klogw |
com.kmpstarter.utils.logging.Log.w(null,"$FUNNAME$: $MESSAGE$") |
$FUNNAME$ → kotlinFunctionName() |
kloge |
com.kmpstarter.utils.logging.Log.e(null,"$FUNNAME$: $MESSAGE$") |
$FUNNAME$ → kotlinFunctionName() |
Live Templates
Using live templates will save tons of time when writing log statements. Official JetBrains documentation: Live Templates