项目作者: hash-bang

项目描述 :
Plugin for async-chainable that provides simple logging
高级语言: JavaScript
项目地址: git://github.com/hash-bang/async-chainable-log.git
创建时间: 2016-04-27T00:32:30Z
项目社区:https://github.com/hash-bang/async-chainable-log

开源协议:MIT License

下载


async-chainable-log

Plugin for async-chainable that provides simple logging.

  1. var asyncChainable = require('async-chainable');
  2. var asyncChainableLog = require('async-chainable-log');
  3. asyncChainable()
  4. .use(asyncChainableLog)
  5. .log('Waiting 1000ms')
  6. .then(function(next) {
  7. setTimeout(next, 1000);
  8. })
  9. .logDefaults({prefix: '\t\t'})
  10. .log('This will be indented with two tabs')
  11. .end();

API

The async-chainable-log API exposes two API calls log() and logDefaults() the first simply logs and the second takes an object with the following parameters:

Option Description
callback Optional callback function to use for logging. The default is console.log
prefix Optional prefix to prepend to all logging output before it is passed to the callback
suffix Optional suffix to append to all logging output before it is passed to the callback