rumor
A logger
Last updated 3 years ago by kparkov .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install rumor 
SYNC missed versions from official npm registry.

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);

Current Tags

  • 1.1.0                                ...           latest (3 years ago)

10 Versions

  • 1.1.0                                ...           3 years ago
  • 1.0.0                                ...           4 years ago
  • 0.3.0                                ...           4 years ago
  • 0.2.0                                ...           4 years ago
  • 0.1.5                                ...           4 years ago
  • 0.1.4                                ...           4 years ago
  • 0.1.3                                ...           4 years ago
  • 0.1.2                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 11
Last Day 0
Last Week 11
Last Month 0
Dependencies (3)
Dev Dependencies (7)

Copyright 2014 - 2016 © taobao.org |