Hi, i am using this `implementation("io.github.osh...
# kotlin-logging
t
Hi, i am using this
implementation("io.github.oshai:kotlin-logging-android-debug:7.0.13")
in my current android project and can only generate error, warning and info logcat messages i have set
Copy code
init {
    System.setProperty("kotlin-logging-to-android-native", "true")
}
in my Android application before any logger is used, what else do i need to do to have debug logs appear?
o
maybe something like this:
Copy code
adb shell setprop log.tag VERBOSE
🙌 1
t
yes, already tried that adb shell setprop log.tag VERBOSE it works however i want to enable debug in code, NOT from console ive achieved via this class
Copy code
internal class KLoggerAndroid(override val name: String) : KLogger {

    override fun at(level: Level, marker: Marker?, block: KLoggingEventBuilder.() -> Unit) {
        if (isLoggingEnabledFor(level, marker)) {
            KLoggingEventBuilder().apply(block).run {
                when (level) {
                    Level.TRACE -> Log.v(name, this.message, this.cause)
                    Level.DEBUG -> Log.d(name, this.message, this.cause)
                    <http://Level.INFO|Level.INFO> -> Log.i(name, this.message, this.cause)
                    Level.WARN -> Log.w(name, this.message, this.cause)
                    Level.ERROR -> Log.e(name, this.message, this.cause)
                    Level.OFF -> Unit
                }
            }
        }
    }

    override fun isLoggingEnabledFor(level: Level, marker: Marker?): Boolean = Environment.isDebug
}
although it seems quite "Heavy" just to enable log level
o
are you sure it's really working? I think
Log.d()
is checking again if level is enabled and it should not log when isLoggable returns false
t
do you know of any way to affect "isLoggable()", via code not console commands?
o
The link from above suggest something like :`adb shell setprop log.tag.FOO_TAG VERBOSE`