Socket
Socket
Sign inDemoInstall

through-logged

Package Overview
Dependencies
3
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    through-logged

Through stream that logs to console everything that passes through it.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
23.9 kB
Created
Weekly downloads
 

Readme

Source

Logged though stream

Build Status

Synopsis

Through stream that logs to console everything that passes through it. Use it as a quick debuuging tool by inserting in at a right point of a pipeline to see what is passing through.

##Description

Let say that you have the following pipeline

    var spawn =  require('child_process').spawn,
        child = require('event-stream').child,
        filed = require('filed');
        filed('/etc/passwd').pipe(child(spawn('grep',['odysseas']))
                            .pipe(child(spawn('wc', ['-l']));

and you are wondering what is being piped through the grep process to the wc - and do so without affecting the rest of the program. You can do :

    var throughLogged = require('through-logged');
    ....
        filed('/etc/passwd').pipe(child(spawn('grep',['odysseas']))
                            .pipe(throughLogged())  // we inserted the logger here.
                            .pipe(child(spawn('wc', ['-l']));

which will print to the output the greped lines - before passed to wc.

The code of this module is tiny:

var tee = require('tee-1'),
    consoleStream = require('console-stream');

function throughLogged() {
    return tee(consoleStream());
}
module.exports = throughLogged;

Installation

npm install through-logged

Keywords

FAQs

Last updated on 04 Aug 2013

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc