Coverage Summary for Class: MainActivity (com.javiersc.mokoki.core)
Class |
Class, %
|
Method, %
|
Branch, %
|
Line, %
|
Instruction, %
|
MainActivity |
0%
(0/1)
|
0%
(0/2)
|
|
0%
(0/8)
|
0%
(0/32)
|
@file:Suppress("MagicNumber")
package com.javiersc.mokoki.core
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.javiersc.mokoki.AndroidMokokiLogger
import com.javiersc.mokoki.LoggerSeparator
import com.javiersc.mokoki.MokokiLogger
import com.javiersc.mokoki.Priority
import com.javiersc.mokoki.logD
import com.javiersc.mokoki.logE
import com.javiersc.mokoki.logI
import com.javiersc.mokoki.logV
import com.javiersc.mokoki.logW
import com.javiersc.mokoki.logWTF
class MainActivity : AppCompatActivity(R.layout.main_activity) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
App(false)
println(" ")
println("------------------------------------------------------------")
println("------------------------------------------------------------")
println(" ")
App(true)
}
}
class App(useCompatibleMode: Boolean) {
init {
showColors(useCompatibleMode)
}
private fun showColors(useCompatibleMode: Boolean) {
MokokiLogger.uninstallAllLoggers()
val androidMokokiLogger =
AndroidMokokiLogger(minPriority = Priority.VERBOSE).apply {
this.useCompatibleMode = useCompatibleMode
}
MokokiLogger.install(androidMokokiLogger)
logV("SomeTag") { "Unlucky bug" }
logD("SomeTag") { "Unlucky bug" }
logI("SomeTag") { "Unlucky bug" }
logW("SomeTag") { "Unlucky bug" }
logE("SomeTag") { "Unlucky bug" }
logWTF("SomeTag") { "Unlucky bug" }
println("")
println(" ------------------------------------------------------------")
println("")
logV { "Example without TAG" }
logD { "Example without TAG" }
logI { "Example without TAG" }
logW { "Example without TAG" }
logE { "Example without TAG" }
logWTF { "Example without TAG" }
val textWithSeparator =
"""
Text before first separator
${LoggerSeparator(useCompatibleMode)}
Text after first separator and before last separator
${LoggerSeparator(useCompatibleMode)}
Text after last separator
"""
.trimIndent()
logV { textWithSeparator }
}
}