- Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency
dependencies {
implementation 'com.github.BestDI:ScreenLogger:v1.0'
}
- init in your application:
override fun onCreate() {
super.onCreate()
ProcessLifecycleOwner.get().lifecycle.apply {
val isEnable = true // 可以通过isEnable的状态控制是否打开ScreenLog
addObserver(LoggerLifecycleObserver(this@MainApplication, isEnable))
}
}
now, you could use it:
Logger.warn("TAG", "hello from button")
or you could use:
typealias ScreenLogger = Logger
1.request permission(above android 6.0)
2.tracking log
3.log details