The logger davglass uses in his CLI tools


This is the logger that I use in my CLI tools.

var logger = require('davlog');
    name: 'foo',
    color: 'white'
}); //Should only need once 
logger.info('This is a test');

foo [info] This is test

  • info
  • log
  • warn
  • err
  • error Will process.exit(1) when called.
  • silent Disable all output
  • quiet Disable all but log and info

The init function allows for 3 options:

  • name - The name prefix to the string: Defaults to: 'davlog'
  • color - The string for the color or false to disable color: Defaults to magenta
  • timestamps - If true, adds an ISO timestamp to the beginning of each log line.

You can override all prefixes by using the: davlog.STRINGS object. You can override all default colors by using the davlog.COLORS object.