GitXplorerGitXplorer
l

stream-log-level

public
4 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
912321958b0a46cb7fc036f22a08ff0196668028

[doc] Add missing space

llpinca committed 9 years ago
Unverified
0bf7feb7eb244e86506c0faadf7c2747405a75df

[dist] 1.0.0

llpinca committed 9 years ago
Unverified
915a177c842f0d9902f0038d34f74416b0757bf2

[doc] Fix badges

llpinca committed 9 years ago
Unverified
c8c91f75a4cd47f72fa517a32850a94ba4938290

[doc] Fix options table

llpinca committed 9 years ago
Unverified
615051174bd9d2ba21b602d3243b5c88cc96d28d

[init] First commit

llpinca committed 9 years ago

README

The README file for this repository.

stream-log-level

Version npm Build Status Coverage Status

Simple and lightweight logger that writes to a stream.

This module is like console-log-level but instead of using the console object it uses a given stream.

Log levels supported: trace, debug, info, warn, error and fatal.

Install

npm install --save stream-log-level

Usage

var logger = require('stream-log-level');

var log = logger();

log.trace('a'); // => does nothing
log.debug('b'); // => does nothing
log.info('c'); // => writes 'c\n' to STDOUT
log.warn('d'); // => writes 'd\n' to STDOUT
log.error('e'); // => writes 'e\n' to STDOUT
log.fatal('f'); // => writes 'f\n' to STDOUT

Options

The logger can be configured by passing in an options object:

var logger = require('stream-log-level');

var log = logger({
  prefix: function () {
    return new Date().toISOString();
  },
  level: 'info'
});

Supported options:

Name Description Type Default value
level Specify the log level String info
prefix Set a prefix for all log messages String or Function undefined
stream The stream to write to Stream process.stdout

License

MIT