Created
February 9, 2018 07:52
-
-
Save sergiocasero/ecfb397b76739a6f61410f1605583e27 to your computer and use it in GitHub Desktop.
Kotlin Android logging extensions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.util.Log | |
/** | |
* AndroidExtensions | |
*/ | |
/** | |
* Any | |
* */ | |
fun 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) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment