UNPKG

yadsil

Version:

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

42 lines (31 loc) 926 B
# 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 ```bash $ npm install yadsil --save ``` # Usage ```js 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.