Skip to content

Instantly share code, notes, and snippets.

@sergiocasero
Created February 9, 2018 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergiocasero/ecfb397b76739a6f61410f1605583e27 to your computer and use it in GitHub Desktop.
Save sergiocasero/ecfb397b76739a6f61410f1605583e27 to your computer and use it in GitHub Desktop.
Kotlin Android logging extensions
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