Bunyan formatted tracking of outstanding promises, progress, errors, and resolution times
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.editorconfig
.gitignore
.jshintrc
.npmignore
.travis.yml
Gruntfile.js
README.md
package.json

README.md

Bunyan-Promise

Bunyan-Promise consumes promises and outputs bunyan logs showing their progress, their resolution or rejection, and makes state dumps showing all promises that have not settled.

How?

Bunyan-Promise can consume any type of promises, but for the sake of this example we'll use one from Kriskowal's Q Library.

var q = require('q');
var BunyanPromiseLogger = require('bunyan-promise');
var logger = new BunyanPromiseLogger({
  name: 'test-logger'
});
var defer = q.defer();
logger.trace(defer.promise, 'arbitrary promise name for logging');

// sometime in the future resolve that promise
setTimeout(function () {
  defer.resolve();
}, 10000);

Example output

This is pretty printed by piping the output through the bunyan cli.

node app.js | bunyan -o short

Alternatively you can use the bunyan grunt task if you're using grunt

npm install --save-dev grunt-bunyan
grunt bunyan task1 task2 ...