As we have used Log.e()
for logging error with java code. I was looking for same functionality with Kotlin
. Though i have found Logger class
val Log = Logger.getLogger(MainActivity::class.java.name)
Log.warning("Hello World")
It is showing log in android studio logcat.
But does there any way to print log in red color the same way Log.e() does?
You can use log like this Log.d(TAG, "my Message")
in KOTLIN
Log.e()
will work perfectly in Kotlin.
In Kotlin, we also have a Logger class to log something.
Logger.getLogger(Test::class.java.name).warning("Hello..")
Otherwise, you have to use some other library like: kotlin-logging, anko logging etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With