Skip to content

Repository files navigation

LogBox Poster

LogBox

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.


Features

  • 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.

Installation

To integrate LogBox into your Android project, you need to add JitPack to your project-level build.gradle file:

Step 1: Add JitPack Repository

In your project-level build.gradle file, add the JitPack repository:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Step 2: Add LogBox Dependency

Then, add the following dependency to your app-level build.gradle file:

implementation 'com.github.AsadbekTurgunboyev:LogBox:2.2.2'

Usage

Step 1: Initialize LogBox

Initialize the LogBox library in your Application class or MainActivity:

LogBox.init(this) {
    logLevel = LogLevel.DEBUG // Set the minimum log level to display
}

Step 2: Add Logs in Your Application

Use LogBox.log() to log messages:

LogBox.log(LogLevel.INFO, "MainActivity", "This is an informational log!")
LogBox.log(LogLevel.ERROR, "MainActivity", "Something went wrong!")

Step 3: Display the Floating Widget

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()

Customization

Log Levels

LogBox supports the following log levels:

  • LogLevel.DEBUG
  • LogLevel.INFO
  • LogLevel.WARN
  • LogLevel.ERROR

You can set the minimum log level during initialization:

LogBox.init(this) {
    logLevel = LogLevel.ERROR // Only show ERROR level logs
}

Floating Widget Behavior

Customize the floating widget position and visibility as needed. By default, it appears in the top-left corner of the screen.


Example Project

Check out the example app to see LogBox in action.


Contributions

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.


License

This project is licensed under the MIT License.


Author

Developed and maintained by Asadbek Turgunboyev.


Special Thanks

Special thanks to everyone who helped in testing and providing feedback for LogBox. ❤️

About

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.

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages