0

I am using Kotlin-Logging in my Android App. How do I set the TAG for my log statements?

Currently in my view-model I have something like:

class MyViewModel(private val dictionary: Dictionary) : ViewModel() {
    companion object: NamedKLogging("TAG")
    ....

fun something() {
   logger.i {"something is happening"}
}

In Logcat I see:

2021-12-13 19:42:51.749 18554-18554/app-name W/System.err: [main] INFO TAG - something is happening

What do I need to do to replace the W/System.err with I/TAG?

hba
  • 7,406
  • 10
  • 63
  • 105
  • please refer this https://developer.android.com/studio/debug/am-logcat – Vijay S Dec 14 '21 at 04:11
  • Thanks @VijayS but I need a way to pass a tag into the log statement. I read the am-logcat document, i still can't tell how to do that. If you know how, pls include it in the answer. – hba Dec 14 '21 at 18:35

0 Answers0