LogBox is a lightweight and easy-to-use logging library for Android applications. It provides an overlay widget to display logs in real-time while debugging, allowing developers to monitor logs directly within the app's UI.
- Floating Widget: A movable widget that displays logs in real-time.
- Customizable Log Levels: Supports
DEBUG,INFO,WARN,ERROR, etc. - No Additional Storage: Logs are stored in memory to minimize storage impact.
- Easy Integration: Add the library and start logging with minimal setup.
To integrate LogBox into your Android project, you need to add JitPack to your project-level build.gradle file:
In your project-level build.gradle file, add the JitPack repository:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}Then, add the following dependency to your app-level build.gradle file:
implementation 'com.github.AsadbekTurgunboyev:LogBox:2.2.2'Initialize the LogBox library in your Application class or MainActivity:
LogBox.init(this) {
logLevel = LogLevel.DEBUG // Set the minimum log level to display
}Use LogBox.log() to log messages:
LogBox.log(LogLevel.INFO, "MainActivity", "This is an informational log!")
LogBox.log(LogLevel.ERROR, "MainActivity", "Something went wrong!")Call LogBox.showFloatingWidget() to display the floating widget in your app:
LogBox.showFloatingWidget()You can also hide the widget when it’s no longer needed:
LogBox.hideFloatingWidget()LogBox supports the following log levels:
LogLevel.DEBUGLogLevel.INFOLogLevel.WARNLogLevel.ERROR
You can set the minimum log level during initialization:
LogBox.init(this) {
logLevel = LogLevel.ERROR // Only show ERROR level logs
}Customize the floating widget position and visibility as needed. By default, it appears in the top-left corner of the screen.
Check out the example app to see LogBox in action.
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
This project is licensed under the MIT License.
Developed and maintained by Asadbek Turgunboyev.
Special thanks to everyone who helped in testing and providing feedback for LogBox. ❤️
