Skip to content

RxDebug is a kotlin extension that provides a very simple way of debugging RxJava2 streams

License

Notifications You must be signed in to change notification settings

SumeraMartin/RxDebug

Repository files navigation

Bitrise Status

RxDebug

Simple kotlin extension for logging useful information from RxJava2 streams.

The debug extension will automatically figure out from which class it's being called and use that class name as its tag.

Usage

Observable.just("One", "Two", "Three")
        .debug()  // The name of an enclosing class will be used as a tag
        .subscribe()

This code snippet will produce the following output to the log:

OR

Observable.just("One", "Two", "Three")
        .debug(tag = "Words") // The name of an enclosing class and "Words" will be used as a tag
        .subscribe()

This code snippet will produce the following output to the log:

In order to have a clearer log messages RxDebug allows you to transform onNext/onSuccess values that are added to the log:

Observable.just("One", "Two", "Three")
        .debug(tag = "Words length") { it.substring(0, 2) } // The log for onNext values will contain "On", "Tw", "Th"
        .subscribe()

RxDebug supports all RxJava2 stream types (Observable, Flowable, Single, Maybe, Completable)

Setup

In order to disable debug logs globally:

RxDebug.setLoggingEnabled(false) // Logging is enabled by default

Download

implementation 'com.sumera.rxdebug:rxdebug:1.1.2'

About

RxDebug is a kotlin extension that provides a very simple way of debugging RxJava2 streams

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages