Skip to content

Some simple kotlin extension methods and tools can speed up the development of Android.

License

Notifications You must be signed in to change notification settings

snowman-team/DebugLogger

Repository files navigation

Snowball Android Debug Logger
Download

Debug log utils that is easy to use.

Installation

dependencies {
    // add dependency, please replace x.y.z to the latest version
    implementation "com.xueqiu.debuglogger:debuglogger:x.y.z"
    
    // with bugly
    implementation "com.xueqiu.debuglogger:bugly:x.y.z"
}

Usage

DLog

// declare your params
val map = HashMap<String, String>()
        map[BaseDebugLogger.KEY_APP_CHANNEL] = "channel"
        map[BaseDebugLogger.KEY_APP_VERSION] = "version_name"

// set option
val options = DebugLogOptions().isDebug(true)
        .withLogger(InfoLogger()) // default logger
        .withParams(map)

// init DLog
DLog.init(AppContext.INSTANCE, options)

// then use it
DLog.i("test")
DLog.v("test")
DLog.d("test")
DLog.w("test")
DLog.e("test")
DLog.e(throwable)

You will see logs in your terminal like this and the log is clickable.

BuglyLogger

If you use the bugly to collect java crash.

// add logger to options
withLogger(BuglyDebugLogger("746b3e9b70")) // replace to your bugly app id

// bugly will automatically collect your crash information
// You can also manually upload crash information like below
DLog.e("test" , true)
DLog.e(throwable , true)

// get logger by id
val logger = DLog.getLogger<BuglyDebugLogger>(BuglyDebugLogger.LOGGER_ID_BUGLY)

CustomLogger

In addition, you can also implement your own logger by extending BaseDebugLogger.

About

Some simple kotlin extension methods and tools can speed up the development of Android.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published