Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RxLogSubscriber for subjects or hot observable #24

Open
emakar opened this issue Mar 24, 2016 · 1 comment
Open

RxLogSubscriber for subjects or hot observable #24

emakar opened this issue Mar 24, 2016 · 1 comment

Comments

@emakar
Copy link

emakar commented Mar 24, 2016

Currently logging shared hot observable or subject via RxLogObservable could result in unreadable log:

Assume we have a subject returned as observable and we just want to log its emission (and possibly - subscribers count)
Currently it's only possible to annotate a method with RxLogObservable

BehaviorSubject bus = BehaviorSubject.create();

@RxLogObservable Observable bus() {
  return bus.asObservable();
}
...
bus.onNext(theEvent);
...
Subscription subscription1 = bus().subscribe()
...
Subscription subscriptionN = bus().subscribe()

And for each Subscriber we'll have a log entry per emission/completion/error, entries are equal though

Frodo => [@Observable#bus() -> onNext() -> theEvent]  // <-- subscription1
...
Frodo => [@Observable#bus() -> onNext() -> theEvent]  // <-- subscriptionN

RxLogObservable is a neat way for logging observables, however it makes logs totally unreadable if one has several subjects and subscribers for them.

So it would be cool to enhance existent annotation or add a new one to log only subject's (subscriber's) onNext/etc (It seems more natural to log subjects as RxLogSubscriber since we're essentially interested in its onNext invocations, however we cannot annotate single instance with it, it's applicable for class only)

@android10
Copy link
Owner

Sorry for the late reply but I will take all this feedback for the next version of frodo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants