A log library specially designed for Kotlin scenarios in Android development. It's inspired by Android-PLog.
This library does not care persistence or encryption; other libraries does this and you can combine usage with them.
dependencies {
implementation 'org.mym.kotlog:kotlog:$latest_version'
}Using jitPack
dependencies {
implementation 'com.github.Muyangmin:Kotlog:$latest_version'
}In you Application#onCreate():
L.install();
If you forget to call install() method, you will receive an Exception at runtime.
L.v("Hello World!")For example to simplify group usage:
fun L.logLifecycle(msg: String?) = d(msg) {
group = "Lifecycle"
stackOffset = 1
}There are 2 types of interceptors: appInterceptor and logInterceptor. Both of them are Interceptor interface, but usage is different: appInterceptor only proceed origin log request, while logInterceptor only proceed decorated(e.g. added log tag, or line number) log request.
L.addApplicationInterceptor({ !BuildConfig.DEBUG })A builtin DebugPrinter can be used to print to logcat. If you wants another output, just implement Printer interface, add call L.addPrinter(it).
Warning: calling L.v/d/i/w/e/objects() methods is a common bug, it leads to infinite loops.