Skip to content

Commit

Permalink
Make logs extension functions inline to reduce method call overheads
Browse files Browse the repository at this point in the history
  • Loading branch information
kirtan403 committed Aug 14, 2018
1 parent 31b3cca commit d060319
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions k4kotlin/src/main/java/com/livinglifetechway/k4kotlin/Log.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@ val Any.TAG: String
/**
* Logs current object as Debug
*/
fun Any.logD(tag: String = TAG) = Log.d(tag, toString())
inline fun Any.logD(tag: String = TAG) = Log.d(tag, toString())

/**
* Logs current object as Information
*/
fun Any.logI(tag: String = TAG) = Log.i(tag, toString())
inline fun Any.logI(tag: String = TAG) = Log.i(tag, toString())

/**
* Logs current object as Verbose
*/
fun Any.logV(tag: String = TAG) = Log.v(tag, toString())
inline fun Any.logV(tag: String = TAG) = Log.v(tag, toString())

/**
* Logs current object as Warning
*/
fun Any.logW(tag: String = TAG) = Log.w(tag, toString())
inline fun Any.logW(tag: String = TAG) = Log.w(tag, toString())

/**
* Logs current object as Error
*/
fun Any.logE(tag: String = TAG) = Log.e(tag, toString())
inline fun Any.logE(tag: String = TAG) = Log.e(tag, toString())

/**
* Logs current object as Wtf (What a Terrible Failure)
*/
fun Any.logWtf(tag: String = TAG) = Log.wtf(tag, toString())
inline fun Any.logWtf(tag: String = TAG) = Log.wtf(tag, toString())

0 comments on commit d060319

Please sign in to comment.