1.1.0 • Published 10 years ago
davlog v1.1.0
davlog
This is the logger that I use in my CLI tools.
usage
var davlog = require('davlog');
var logger = davlog.init({
name: 'foo',
color: 'white'
}); //Should only need once
logger.info('This is a test');foo [info] This is test
Note that the module is an instance of itself, with the default options:
var davlog = require('davlog');
logger.info('This is a test');davlog [info] This is test
methods
infologwarnerrerrorWillprocess.exit(1)when called.silentDisable all outputquietDisable all but log and info
options
The init function allows for 3 options:
name- The name prefix to the string: Defaults to: 'davlog'color- The string for the color orfalseto disable color: Defaults tomagentatimestamps- If true, adds an ISO timestamp to the beginning of each log line.stdout- A writeable stream for normal log messages: Defaults toprocess.stdoutstderr- A writeable stream for error log messages: Defaults toprocess.stderr
You can override all prefixes by using the: logger.STRINGS object.
You can override all default colors by using the logger.COLORS object.
There are also stdout and stderr properties on the object, which are
readable streams. These are useful for piping log data elsewhere.

