1.1.0 • Published 8 years ago

rumor v1.1.0

Weekly downloads
322
License
ISC
Repository
github
Last release
8 years ago

A simple logging module that sports 5 levels of logging:

  • trace
  • debug
  • info
  • warn
  • error

The level shown in stdout is determined by the rumor env var. Set it, and everything of that level or higher will be shown. It will default to info.

Output is colored / formatted (using chalk), and will show level, namespace, date and message:

info   rumor 2016-11-04 12:29:06  info
warn   rumor 2016-11-04 12:29:06  warn
error  rumor 2016-11-04 12:29:06  error

The namespace will default to the current package name, if nothing is given.

Install

npm install --save rumor

Usage

const rumor = require('rumor')('mymodule');

rumor('This will default to `debug` level (default shown level is `info`).');
rumor.debug('This is a debugging message');

// debug  mymodule 2016-11-04 12:29:06  This is a debugging message

rumor.info('This is an info message', 'my namespace');

// info   my namespace 2016-11-04 12:29:06  This is an info message

rumor will expand objects and arrays using util.inspect, to an arbitrary depth.

All of the methods return the message object, which can be used to log an object inside a promise chain and continue:

return Promise.resolve({ name: 'John Smith', born: 1980 })
	.then(rumor.trace)
	.then(person => /* do something */)
	.catch(rumor.error);
1.1.0

8 years ago

1.0.0

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago