yadsil

Yet Another Dead-SImple Log on stderr for CLI tools.

npm install yadsil
5 downloads in the last week
34 downloads in the last month

Yadsil

Yet another dead-simple log, on stderr, for CLI tools. Only when on a TTY, enable colors. Only when not on a TTY, prefix each output with the CLI tool name. Possibility to reactivate colors when not on a TTY (it's up to you to provide a --color option or something). That's all.

Install

$ npm install yadsil --save

Usage

log = require('yadsil')('my-tool-name');
// Enable verbose: just display `info` and `debug` messages.
log.verbose(true);
// Force colors (just needed when not in a TTY).
log.color(true);
// Exit after the message.
log.fatal(1, 'exit with %s', 'one');
// Basic messages.
log.error('foo');
log.warning('bar')
log.notice('baz');
log.info('dru');
log.debug('waf');

That's all.

Limitations

No log levels, no fancy features, not timestamps. Just the bare minimum on top of stderr, and will stay that way.

Contribute

Feel free to fork and submit pull requests.

npm loves you