Skip to content

Instantly share code, notes, and snippets.

@vlasy
vlasy / stream-switch.js
Last active November 2, 2018 12:54
cosmas - Example of how to dispatch log messages to different targets based on the message itself (in this case the logger's name).
const { Writable } = require('stream');
const ackLogger = require('./dist/index.js').default;
const QUERY_LOGGER_NAME = 'query';
const logger = ackLogger({
streams: [
{
stream: new Writable({
write: (chunk, _encoding, next) => {