Netflix/RxJava — pull request #836 by abersnaze (2014-02-07 08:30:23+00:00)
Title: Setting up the new subproject for debugging observable chains.

By creating and registering this plugin you get a complete log of all the events (subscribe, onNext, onError, onCompleted and unsubscribe) that happen in all observables, observers and subscribers. The debug hook also takes a Func1 for transforming data before they are sent to actual onNext functions.

This pull request is for the raw data. There isn't any persistence or visualization of the data generated yet.

Here is an example of a simple observable chain
```
from(1, 3).flatMap({ it -> from(it, it + 1) }).take(3).subscribe()
```
And the stream of notifications sent.
```
{ "nano": 1391761208271225000, "thread": 1, "observer": "rx.Observable$27@3290a11e", "type": "Subscribe", "source": "rx.Observable$2@3541d281"}
{ "nano": 1391761208272832000, "thread": 1, "observer": "rx.operators.OperatorTake$1@f81c4a1", "type": "Subscribe", "source": "rx.Observable$2@10942dfb", "to": "rx.operators.OperatorTake@7056c23d"}
{ "nano": 1391761208275469000, "thread": 1, "observer": "rx.operators.OperatorMerge$1@49c5146e", "type": "Subscribe", "source": "rx.Observable$2@29c06798", "to": "rx.operators.OperatorMerge@16d14192"}
{ "nano": 1391761208275644000, "thread": 1, "observer": "rx.operators.OperatorMap$1@427e3f2", "type": "Subscribe", "source": "rx.operators.OperatorFromIterable@56e626ff", "to": "rx.operators.OperatorMap@200a5beb"}
{ "nano": 1391761208276707000, "thread": 1, "observer": "rx.operators.OperatorMap$1@427e3f2", "type": "OnNext", "value": "1", "to": "rx.operators.OperatorMap@200a5beb"}
{ "nano": 1391761208276839000, "thread": 1, "observer": "rx.operators.OperatorMerge$1@49c5146e", "type": "OnNext", "value": "rx.Observable@299b78d4", "from": "rx.operators.OperatorMap@200a5beb", "to": "rx.operators.OperatorMerge@16d14192"}
{ "nano": 1391761208277012000, "thread": 1, "observer": "rx.operators.OperatorMerge$1$InnerObserver@2b6dd9c5", "type": "Subscribe", "source": "rx.operators.OperatorFromIterable@38f42ac9"}
{ "nano": 1391761208277075000, "thread": 1, "observer": "rx.operators.OperatorMerge$1$InnerObserver@2b6dd9c5", "type": "OnNext", "value": "1"}
{ "nano": 1391761208277166000, "thread": 1, "observer": "rx.operators.OperatorTake$1@f81c4a1", "type": "OnNext", "value": "1", "from": "rx.operators.OperatorMerge@16d14192", "to": "rx.operators.OperatorTake@7056c23d"}
{ "nano": 1391761208277243000, "thread": 1, "observer": "rx.Observable$27@3290a11e", "type": "OnNext", "value": "1", "from": "rx.operators.OperatorTake@7056c23d"}
{ "nano": 1391761208277338000, "thread": 1, "observer": "rx.operators.OperatorMerge$1$InnerObserver@2b6dd9c5", "type": "OnNext", "value": "2"}
{ "nano": 1391761208277397000, "thread": 1, "observer": "rx.operators.OperatorTake$1@f81c4a1", "type": "OnNext", "value": "2", "from": "rx.operators.OperatorMerge@16d14192", "to": "rx.operators.OperatorTake@7056c23d"}
{ "nano": 1391761208277471000, "thread": 1, "observer": "rx.Observable$27@3290a11e", "type": "OnNext", "value": "2", "from": "rx.operators.OperatorTake@7056c23d"}
{ "nano": 1391761208277557000, "thread": 1, "observer": "rx.operators.OperatorMerge$1$InnerObserver@2b6dd9c5", "type": "OnCompleted"}
{ "nano": 1391761208279076000, "thread": 1, "observer": "rx.operators.OperatorMap$1@427e3f2", "type": "OnNext", "value": "3", "to": "rx.operators.OperatorMap@200a5beb"}
{ "nano": 1391761208279154000, "thread": 1, "observer": "rx.operators.OperatorMerge$1@49c5146e", "type": "OnNext", "value": "rx.Observable@24d8116d", "from": "rx.operators.OperatorMap@200a5beb", "to": "rx.operators.OperatorMerge@16d14192"}
{ "nano": 1391761208279252000, "thread": 1, "observer": "rx.operators.OperatorMerge$1$InnerObserver@65601e00", "type": "Subscribe", "source": "rx.operators.OperatorFromIterable@951c5ff"}
{ "nano": 1391761208279322000, "thread": 1, "observer": "rx.operators.OperatorMerge$1$InnerObserver@65601e00", "type": "OnNext", "value": "3"}
{ "nano": 1391761208279409000, "thread": 1, "observer": "rx.operators.OperatorTake$1@f81c4a1", "type": "OnNext", "value": "3", "from": "rx.operators.OperatorMerge@16d14192", "to": "rx.operators.OperatorTake@7056c23d"}
{ "nano": 1391761208279483000, "thread": 1, "observer": "rx.Observable$27@3290a11e", "type": "OnNext", "value": "3", "from": "rx.operators.OperatorTake@7056c23d"}
{ "nano": 1391761208279562000, "thread": 1, "observer": "rx.Observable$27@3290a11e", "type": "OnCompleted", "from": "rx.operators.OperatorTake@7056c23d"}
{ "nano": 1391761208279692000, "thread": 1, "observer": "rx.Observable$27@3290a11e", "type": "Unsubscribe", "from": "rx.operators.OperatorTake@7056c23d"}
{ "nano": 1391761208279756000, "thread": 1, "observer": "rx.operators.OperatorTake$1@f81c4a1", "type": "Unsubscribe", "from": "rx.operators.OperatorMerge@16d14192", "to": "rx.operators.OperatorTake@7056c23d"}
{ "nano": 1391761208279830000, "thread": 1, "observer": "rx.operators.OperatorMerge$1@49c5146e", "type": "Unsubscribe", "from": "rx.operators.OperatorMap@200a5beb", "to": "rx.operators.OperatorMerge@16d14192"}
{ "nano": 1391761208279880000, "thread": 1, "observer": "rx.operators.OperatorMap$1@427e3f2", "type": "Unsubscribe", "to": "rx.operators.OperatorMap@200a5beb"}
{ "nano": 1391761208279946000, "thread": 1, "observer": "rx.operators.OperatorMerge$1$InnerObserver@2b6dd9c5", "type": "Unsubscribe"}
{ "nano": 1391761208280018000, "thread": 1, "observer": "rx.operators.OperatorMerge$1$InnerObserver@65601e00", "type": "Unsubscribe"}
{ "nano": 1391761208280085000, "thread": 1, "observer": "rx.operators.OperatorMap$1@427e3f2", "type": "OnCompleted", "to": "rx.operators.OperatorMap@200a5beb"}
{ "nano": 1391761208280150000, "thread": 1, "observer": "rx.operators.OperatorMerge$1@49c5146e", "type": "OnCompleted", "from": "rx.operators.OperatorMap@200a5beb", "to": "rx.operators.OperatorMerge@16d14192"}
```