yijianlianUI/app/src/main/java/com/yingmao/clash/levellog/AppLog.kt

41 lines
994 B
Kotlin

package com.yingmao.clash.levellog
import com.cncat.vpn.common.log.Log
import com.tencent.mmkv.MMKV
import com.yingmao.clash.conf.BZYConstants
object AppLog {
fun v(tag: String, msg: String) =
log(LogLevel.VERBOSE, tag, msg, null)
fun d(tag: String, msg: String) =
log(LogLevel.DEBUG, tag, msg, null)
fun i(tag: String, msg: String) =
log(LogLevel.INFO, tag, msg, null)
fun w(tag: String, msg: String, tr: Throwable? = null) =
log(LogLevel.WARN, tag, msg, tr)
fun e(tag: String, msg: String, tr: Throwable? = null) =
log(LogLevel.ERROR, tag, msg, tr)
private fun log(
level: LogLevel,
tag: String,
msg: String,
tr: Throwable?
) {
LogDispatcher.enqueue(
LogEvent(
time = System.currentTimeMillis(),
level = level,
tag = tag,
message = msg,
throwable = tr
)
)
}
}