This is the logger that I use in my CLI tools.
var davlog = ;var logger = davlog; //Should only need oncelogger;
foo [info] This is test
Note that the module is an instance of itself, with the default options:
var davlog = ;logger;
davlog [info] This is test
silentDisable all output
quietDisable all but log and info
init function allows for 3 options:
name- The name prefix to the string: Defaults to: 'davlog'
color- The string for the color or
falseto disable color: Defaults to
timestamps- If true, adds an ISO timestamp to the beginning of each log line.
stdout- A writeable stream for normal log messages: Defaults to
stderr- A writeable stream for error log messages: Defaults to
You can override all prefixes by using the:
You can override all default colors by using the
There are also
stderr properties on the object, which are
readable streams. These are useful for piping log data elsewhere.