Member-only story

Debugging RxJS, Part 2: Logging

Nicholas Jamieson
4 min readAug 3, 2017

--

Logging is not exciting.

However, it is a straightforward method for obtaining enough information to beginning reasoning about a problem, without resorting to outright guessing. And it’s often the go-to approach for debugging RxJS-based code.

This is the second in a series of articles — following Debugging RxJS, Part 1: Tooling, which introduced rxjs-spy — and is focused on using logging to solve actual problems. In this article, I’ll show how rxjs-spy can be used to obtain detailed and targeted information in an unobtrusive way.

Let’s look at a simple example that uses the rxjs and rxjs-spy UMD bundles:

The example uses forkJoin to compose an observable that emits an array of GitHub users.

rxjs-spy works with observables that have been tagged using its tag operator — which annotates an observable with a string tag, and nothing more. Before the observable is composed, the example enables spying and configures loggers for tagged observables with tags that match the /user-.+/ regular expression or observables that have a users

--

--

Nicholas Jamieson
Nicholas Jamieson

Written by Nicholas Jamieson

RxJS core team member; front-end developer; mentor; speaker; open-source contributor

Responses (2)