Proxy Pattern: Creating a Logging Writable Stream

Learn how to create proxies that enhance a Writable stream instance adding logging functionality.

We'll cover the following

To see the Proxy pattern applied to a real example, we’ll now build an object that acts as a proxy to a Writable stream, which intercepts all the calls to the write() method and logs a message every time this happens. We’ll use the Proxy object to implement our proxy. Let’s write our code in a logging-writable.js named file.

Get hands-on with 1400+ tech skills courses.