1.0.0 • Published 5 years ago

fancy-log-levels v1.0.0

Weekly downloads
63
License
MIT
Repository
github
Last release
5 years ago

fancy-log-levels

NPM version Downloads

Log things, prefixed with a timestamp and level. Choose what to log, based on verbosity level.

Usage

var log = require('fancy-log-levels');
log(3)

log.debug('a message');
// [16:27:02] [D] a message

log.error('oh no!');
// [16:27:02] [E] oh no!

API

log(lvl)

Sets the debug level.

  • -1 is mute
  • 0 is error and user-info
  • 1 is warning
  • 2 is info
  • 3 is debug

log.debug(msg...)

Logs the message as if you called console.log but prefixes the output with the current time in HH:MM:ss format and [D].

log.error(msg...)

Logs the message as if you called console.error but prefixes the output with the current time in HH:MM:ss format and [E].

log.warn(msg...)

Logs the message as if you called console.warn but prefixes the output with the current time in HH:MM:ss format and [W].

log.info(msg...)

Logs the message as if you called console.info but prefixes the output with the current time in HH:MM:ss format and [I].

log.user(msg...)

Logs the message as if you called console.info but prefixes the output with the current time in HH:MM:ss format and [I].

log.dir(msg...)

Logs the message as if you called console.dir but prefixes the output with the current time in HH:MM:ss format and [D].

License

MIT