Adds StdStore. #12

wants to merge 5 commits into


None yet
4 participants

cpsubrian commented Oct 23, 2012

Adds support for stdin and stdout.

Uses StdStore as the default when no store is provided.

Allows you do do something like:

// app.js

var log = require('jog')();'Hello');
log.debug('Data', {
  property: 'foo',
  value: 'bar'

And then run it like:

$ node app.js 


$ node app.js | jog -f --map type


$ node app.js | jog -f --select " === 'foo'"
{ property: 'foo',
  value: 'bar',
  level: 'debug',
  type: 'Data',
  timestamp: 1350953035191 }

You get the picture :)


cpsubrian commented Oct 23, 2012

Note: Didn't add test because I'm not sure how you would :) child_process.fork() ?

cpsubrian closed this Oct 24, 2012

cpsubrian reopened this Oct 24, 2012


cpsubrian commented Oct 24, 2012



cpsubrian commented Oct 25, 2012

  • Refactored StdStore to accept in/out/err streams (for testing).
  • By default 'error' and 'warn' logs write to stderr and the rest to stdout.
  • redirect options allows you to send all logs to stdout instead.
  • Adds tests for StdStore (adds possible race condition if file or redis access is slow, please take a look).
  • Adds example in examples/stdstore.js so people can play with piping the output to the jog CLI.

I'm starting to get pretty happy with this and was wondering what you though of it.


cpsubrian commented Oct 25, 2012

Also, figured I should give you some background on how we will use this:

We run our node processes via upstart, and allow upstart to log stdout/stderr. We have a daemon that aggregates logs across all our nodes.

Adding this store will facilitate viewing logs on the command-line during development, and then in production we can tail the /var/log/upstart/app.log files and pipe them into the CLI for quick filtering and analysis.


cpsubrian commented Nov 1, 2012

I created and I'm using that for now. It handles all my log output needs, however, this would still be really cool to land in jog because you can't pipe stuff into it on the command-line without this PR.

rauchg commented Nov 1, 2012


gjohnson commented Jan 8, 2013


j0ni commented Mar 28, 2014

+1 this would be super useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment