util: inline log functions
A bit of a stupid workaround now that I use Timber and not my self-rolled logging solution. Timber uses some weird heuristics for names that I don't.
This commit is contained in:
parent
52697ef891
commit
ce5b9e35c7
1 changed files with 5 additions and 5 deletions
|
@ -26,14 +26,14 @@ import timber.log.Timber
|
||||||
*
|
*
|
||||||
* @param obj The object to log.
|
* @param obj The object to log.
|
||||||
*/
|
*/
|
||||||
fun logD(obj: Any?) = logD("$obj")
|
inline fun Any.logD(obj: Any?) = logD("$obj")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log a string message to the debug channel. Automatically handles tags.
|
* Log a string message to the debug channel. Automatically handles tags.
|
||||||
*
|
*
|
||||||
* @param msg The message to log.
|
* @param msg The message to log.
|
||||||
*/
|
*/
|
||||||
fun logD(msg: String) {
|
inline fun Any.logD(msg: String) {
|
||||||
if (BuildConfig.DEBUG && !copyleftNotice()) {
|
if (BuildConfig.DEBUG && !copyleftNotice()) {
|
||||||
Timber.d(msg)
|
Timber.d(msg)
|
||||||
}
|
}
|
||||||
|
@ -44,21 +44,21 @@ fun logD(msg: String) {
|
||||||
*
|
*
|
||||||
* @param msg The message to log.
|
* @param msg The message to log.
|
||||||
*/
|
*/
|
||||||
fun logW(msg: String) = Timber.w(msg)
|
inline fun logW(msg: String) = Timber.w(msg)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log a string message to the error channel. Automatically handles tags.
|
* Log a string message to the error channel. Automatically handles tags.
|
||||||
*
|
*
|
||||||
* @param msg The message to log.
|
* @param msg The message to log.
|
||||||
*/
|
*/
|
||||||
fun logE(msg: String) = Timber.e(msg)
|
inline fun logE(msg: String) = Timber.e(msg)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Please don't plagiarize Auxio! You are free to remove this as long as you continue to keep your
|
* Please don't plagiarize Auxio! You are free to remove this as long as you continue to keep your
|
||||||
* source open.
|
* source open.
|
||||||
*/
|
*/
|
||||||
@Suppress("KotlinConstantConditions")
|
@Suppress("KotlinConstantConditions")
|
||||||
private fun copyleftNotice(): Boolean {
|
fun copyleftNotice(): Boolean {
|
||||||
if (BuildConfig.APPLICATION_ID != "org.oxycblt.auxio" &&
|
if (BuildConfig.APPLICATION_ID != "org.oxycblt.auxio" &&
|
||||||
BuildConfig.APPLICATION_ID != "org.oxycblt.auxio.debug") {
|
BuildConfig.APPLICATION_ID != "org.oxycblt.auxio.debug") {
|
||||||
Timber.d(
|
Timber.d(
|
||||||
|
|
Loading…
Reference in a new issue