Vlog was featured in Android Weekly
An In-Display real-time logging Library for Android.
Vlog provides an easy and convenient way to access logs right on your phone.
Messenger chat like bubble is introduced to display logs in a non-intrusive manner. The bubble also shows the count badge to indicate the presence of logs. Along with that, basic filtering capability helps with finding specific logs,
Logs play a crucial part in diagnosing issues. Without proper logging, developers may have to spend countless hours debugging the root cause. When the codebase becomes huge, logs can also prove to be useful in understanding complex execution flows. Although one can argue to follow execution from one breakpoint to another, the whole process can be time-consuming. But for the most part, logs are an indispensable tool in any developer’s arsenal. More so for an android developer where there can be network failures, device permission denials, SQL errors, background thread issues, telemetry data inaccuracies, and innumerable other concerns. And Vlog takes it a step forward and helps in conveniently check logs right on your phone.
Add maven source in root build.gradle
:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the library dependency in build.gradle
file. Notice the no-op
version, an empty implementation, which ensures library is not added to the release builds:
dependencies {
debugImplementation 'com.github.girish3.Vlog:library:v0.3'
releaseImplementation 'com.github.girish3.Vlog:library-no-op:v0.3'
}
The Vlog exposes easy-to-use APIs and has same logging methods as Android's Log utility ( Log.v
, Log.d
...)
val vlog = Vlog.getInstance(context)
// In the above code, make sure to pass application context as an argument instead of Activity context
// start vlogging (the bubble will appear)
vlog.start()
vlog.v("<tag>", "<log message>") // verbose log
vlog.e("<tag>", "<log message>") // error log
// stop vlogging
vlog.stop()
// check if vlog is currently active
vlog.isEnabled() // returns true if vlog.start() was called
Timber is a popular logging library. Timber is extensible therefore Vlog can be seamlessly integrated alongside Timber. Add a behavior through Tree
instance and plant the instance by calling Timber.plant
. For more details, check the timber sample module in this repo.
Often, there is a need to not just print logs but also either to save them in a local file or upload it to a server. The Chain of responsibility pattern is a recommended pattern for such needs. In this pattern, each object in the chain receives the log data and can therefore be responsible to print the log statement (logcat), save in a file, or, in our use-case, pass the data to Vlog library. Refer sample app in this repo for more details. For a quick setup, the app's logger folder can directly be copy-pasted in any Android project.
All types of contribution is accepted. Raise issues, suggest changes or submit a pull request.