All Downloads are FREE. Search and download functionalities are using the official Maven repository.

internal.utils.YwLogger.kt Maven / Gradle / Ivy

There is a newer version: 0.0.4-dev-1
Show newest version
package com.elouyi.bely.internal.utils

import com.elouyi.bely.utils.ElyColor
import com.elouyi.bely.utils.ElyLoggerAbstract
import com.elouyi.bely.utils.LogLevel
import com.elouyi.bely.utils.now

internal open class YwLogger(override val owner: String) : ElyLoggerAbstract(owner){

    override fun vv(message: String) {
        yout(message,"Verbose",ElyColor.ANSI_WHITE)
    }

    override fun dd(message: String) {
        yout(message,"Debug",ElyColor.ANSI_GREEN)
    }

    override fun ii(message: String) {
        yout(message,"Info",ElyColor.ANSI_BLUE)
    }

    override fun ww(message: String) {
        yout(message,"Warn",ElyColor.ANSI_YELLOW)
    }

    override fun ee(message: String, e: Throwable?) {
        if (message != "null") yout(message,"Error",ElyColor.ANSI_RED)
        e?.printStackTrace()
    }

    private val yout = { message: String?,level: String,color: ElyColor ->
        val content = "${now()} $level [$owner] : $message"
        out(color.toString() + content + ElyColor.ANSI_RESET)
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy