erikmedina
10/24/2018, 11:45 AMtirgei
10/24/2018, 11:47 AMSergio Casero
10/24/2018, 11:48 AMSergio Casero
10/24/2018, 11:49 AM/**
* Any
* */
fun <http://Any.info|Any.info>(text: String) {
Log.i(this::class.java.simpleName, text)
}
fun Any.error(text: String) {
Log.e(this::class.java.simpleName, text)
}
fun Any.error(text: String, exception: Exception) {
Log.e(this::class.java.simpleName, text, exception)
}
fun Any.warn(text: String) {
Log.w(this::class.java.simpleName, text)
}
fun Any.warn(text: String, exception: Exception) {
Log.w(this::class.java.simpleName, text, exception)
}
fun Any.debug(text: String) {
Log.d(this::class.java.simpleName, text)
}
fun Any.debug(text: String, exception: Exception) {
Log.d(this::class.java.simpleName, text, exception)
}
erikmedina
10/24/2018, 11:51 AMSergio Casero
10/24/2018, 11:52 AMerikmedina
10/24/2018, 11:56 AMarekolek
10/24/2018, 12:13 PMSergio Casero
10/24/2018, 12:41 PMAllan Wang
10/24/2018, 3:49 PMWithLogging
so that all logs in a specific class are tagged as so:
https://stackoverflow.com/questions/34416869/idiomatic-way-of-logging-in-kotlin
I’m not sure if you want to extend Any
, as your logs are going to be affected if you ever use apply
or other lambdas of type T.() -> ...
egorand
10/24/2018, 3:58 PMAny
is that it messes up code completion, you'll be seeing those functions in the dropdown everywhere, which you probably don't wantrkeazor
10/24/2018, 4:25 PM