GitXplorerGitXplorer
l

stream-log-level

public
4 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
3d50df7bb6efa346d0b7f20d6fdb51f78797c2aa

[doc] Fix Travis CI URL

llpinca committed 5 years ago
Unverified
7dab27c9eed7f40ae37fb8f42d83b9a6114e6e66

[pkg] Update tape to version 4.11.0

llpinca committed 5 years ago
Unverified
8ea7de000337b45a2cdf16f6e36342d80402a215

[pkg] Update pre-commit to version 1.2.2

llpinca committed 5 years ago
Unverified
1e3998976b457ad7aae0a6dccf8797a8ce3c43d9

[pkg] Add .npmrc

llpinca committed 5 years ago
Unverified
b4f827e3f6787bfda5e3cd9732629b029c3d1e24

[pkg] Replace istanbul with nyc

llpinca committed 5 years ago
Unverified
f0bf896fae8d77f83f65525a6ad5d69fc098ce0b

[ci] Test on node 12

llpinca committed 5 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