A super light weight Log Output library in Compose Multiplatform / Kotlin Multiplatform for iOS and Android.
You can see the log in Logcat(Android) and Console(Xcode).
- Verbose
- Debug
- Info
- Warning
- Error
- WTF
Like Log included in the Android standard library, You can see the log outputted by Mplogger in your Logcat.
2024-11-24 10:28:51.912 4903-4903 Mplogger example org.kaitokitaya.credentialmanager V VERBOSE2024-11-24 10:28:57.204 4903-4903 Mplogger example org.kaitokitaya.credentialmanager D DEBUG2024-11-24 10:29:37.029 4903-4903 Mplogger example org.kaitokitaya.credentialmanager I INFO2024-11-24 10:29:38.391 4903-4903 Mplogger example org.kaitokitaya.credentialmanager W WARNING2024-11-24 10:29:39.264 4903-4903 Mplogger example org.kaitokitaya.credentialmanager E ERROR2024-11-24 10:29:40.275 4903-4903 Mplogger example org.kaitokitaya.credentialmanager E WTF!The log doesn't see the Android environment like Logcat. You should launch your application by Xcode. And you can see the log in your console in Xcode
2024-11-24 10:33:34 🔍[VERBOSE] VERBOSE2024-11-24 10:33:35 💻DEBUG DEBUG2024-11-24 10:33:36 ℹ️INFO INFO2024-11-24 10:33:36 ⚠️WARNING WARNING2024-11-24 10:33:36 ❌ERROR ERROR2024-11-24 10:33:37 💣WTF WTF!These kinds of tags are adhered by Android logging rule
implementation("io.github.kate941-su:mplogger:1.0.0")The following code is a part of the UI implementation in Overview.
Button(
onClick = { MPLog.tag("Mplogger example").v("VERBOSE") },
colors = ButtonDefaults.buttonColors(
backgroundColor = Color.Gray,
contentColor = Color.White
)
) {
Text("v")
}The format of outputting logs are the below.
MPLog.tag("<TAG_NAME>").v("<VERBOSE_MESSAGE>")If you want to reuse the MPLog which has a same tag you can instantiate the MPlog.
val helloWorldLog = MPLog.tag("<TAG_NAME>")
helloWorldLog.i("<INFORMATION_MESSAGE>")