Last active
October 1, 2020 14:39
-
-
Save ahmed-shehataa/87027666022e9c1efcc492084fb78fab to your computer and use it in GitHub Desktop.
A custom class to use log only in debug mode not release.
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
class Logger { | |
companion object { | |
private val isDebug = BuildConfig.DEBUG | |
@JvmStatic | |
fun e(tag: String, message: String) { | |
if (isDebug) { | |
Log.e(tag, message) | |
} | |
} | |
@JvmStatic | |
fun v(tag: String, message: String) { | |
if (isDebug) { | |
Log.v(tag, message) | |
} | |
} | |
@JvmStatic | |
fun d(tag: String, message: String) { | |
if (isDebug) { | |
Log.d(tag, message) | |
} | |
} | |
@JvmStatic | |
fun i(tag: String, message: String) { | |
if (isDebug) { | |
Log.i(tag, message) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment