package com.mogo.v2x.logger

import android.util.Log

internal object Logger {

    var loggable: Boolean = false

    fun v(tag: String, msg: String) = if (loggable) Log.v(tag, msg) else 0

    fun d(tag: String, msg: String) = if (loggable) Log.d(tag, msg) else 0

    fun i(tag: String, msg: String) = if (loggable) Log.i(tag, msg) else 0

    fun w(tag: String, msg: String) = if (loggable) Log.w(tag, msg) else 0

    fun e(tag: String, msg: String, t: Throwable? = null) = if (loggable) {
        if (t == null) {
            Log.e(tag, msg)
        } else {
            Log.e(tag, msg, t)
        }
    } else 0
}