alfa-log
color logging to console for Node JS
Last updated 3 years ago by alfalabs.net .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install alfa-log 
SYNC missed versions from official npm registry.

alfa-log

console.log in color for NodeJS

installation:

npm install alfa-log --save

usage:

place this in each module to initialise with module name:

const log = require('alfa-log')('myModuleName');

or, to initialise and display info message:

const log = require('alfa-log')('myModuleName', 'info', 'loaded');

optional arguments: require('alfa-log')(moduleName, level, txt, {bright: true});

  • moduleName - prefixes each message with text in square brackets
  • level - log|info|warn|error - used in conjunction with txt, to display log message
  • txt - used in conjunction with level, to display log message
  • options - {bright: true} to make all messages bright

then call log function:

log.l('normal message', object1, object2, etc);
log.i('blue message');
log.w('yellow message');
log.e('red message');

log.c('cyan message');
log.g('green message');
log.m('magenta message');

to make color brighter use caps:

log.L('bright normal message', object1, object2, etc);
log.I('bright blue message');
log.W('bright yellow message');
log.E('bright red message');

log.C('bright cyan message');
log.G('bright green message');
log.M('bright magenta message');

test how colors are interpreted by your console: run node example.js

console

Current Tags

  • 1.0.0                                ...           latest (3 years ago)

7 Versions

  • 1.0.0                                ...           3 years ago
  • 0.0.6                                ...           3 years ago
  • 0.0.5                                ...           3 years ago
  • 0.0.4                                ...           3 years ago
  • 0.0.3                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 2
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |