Debugging RxJS streams
There are a lot of great tools to debug RxJS streams that can really help us be productive, reproduce issues that may occur, and identify bugs easily. However, what if we don’t need to go through the setup of those tools and can rather have a simple network traffic log to observe what is going on in the network?
How to do it…
In this recipe, we will implement a simple network logger to observe the ongoing network traffic in the browser console. For that purpose, we will leverage Angular interceptors. Also, after each error, we will send the error information to our custom analytics endpoint, to increase our system Observability and Error Tracking.
Step 1 – Logging successful responses
In our network-logger.interceptor.ts
, we will start intercepting ongoing network requests:
export const networkLogger: HttpInterceptorFn = (
req, next) => {
const started = Date.now();
const httpClient...