Skip to content

Latest commit

 

History

History
52 lines (36 loc) · 1.48 KB

README.md

File metadata and controls

52 lines (36 loc) · 1.48 KB

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'