Naive common log for bunyan

npm install commonlog-bunyan
1 downloads in the last day
6 downloads in the last week
40 downloads in the last month

Build Status Dependency Status

Naive Common Log for Bunyan

Getting my head around Bunyan. Relies on module caching to retrieve the same instance of bunyan logger over and over again

What it is...

var bunyan = require("bunyan"),
        Logger = {};

Logger.logger = null;

Logger.init =  function (config) {
    Logger.logger = new bunyan.createLogger(config);

Logger.logTime = function (t, message) {
    message = message || {};
    message.time = process.hrtime(t)[1] / 1000000;

module.exports = Logger;

To avoid this...

logger = require("./lib/logger");
logger = require("../../lib/logger");
logger = require("../../../lib/logger");

Other things

Added a convenience method to log time given an instance of process.hrtime



npm loves you