GitXplorerGitXplorer
k

record-sink

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
9405849fdff40100b2f98ef6423a597cde22e404

2.0.2

kkeis committed 10 years ago
Unverified
ebb58f92d3093be35947353acc83c637a441b674

remove object-assign dependency

kkeis committed 10 years ago
Unverified
39b5c7aebc91152edd0cd75ebcac145398518672

eslint@^0.24.0

kkeis committed 10 years ago
Unverified
d42cbba3003ef97596ee94f7fa38bf9bc987ee9e

chai@^3.0.0

kkeis committed 10 years ago
Unverified
efd7d72524e9cb6d61d8937ce133b67e55e27f27

readable-stream@^2.0.1

kkeis committed 10 years ago
Unverified
389ccbd8007cfb2ecb0a7f5285469855301569ae

2.0.1

kkeis committed 10 years ago

README

The README file for this repository.

record-sink

NPM Version Build Status Coverage Status

Sink for records where the final processing and serialization happens.

Installation

npm install --save record-sink

Usage

This module is building block for creating message logging system and as such doesn't do much on it's own. By combining it with some stream magic it's possible to create a quick and dirty log method that writes neatly formatted log entries to stderr and to a file.

var Sink = require('record-sink')
  , Record = require('log-record')
  , through2 = require('through2')
  , fs = require('fs')
  , logger

logger = through2.obj({objectMode: true}, function (data, enc, cb) {
  cb(null, data)
})

logger.pipe(new Sink())
logger.pipe(new Sink(fs.createWriteStream('application.log')))

function log() {
  var args = Array.prototype.slice.call(arguments)
    , msg = args.shift()
    , record = new Record('main', 20, new Date(), msg, args)

  logger.write(record)
}

log("hello %s", "world")