title: design pattern for wrapping logger in node.js application
body: <p>I am writing a node.js application and using <a href="https://github.com/trentm/node-bunyan" rel="nofollow">bunyan</a> for logging. what i would like to do is to create one instance of the bunyan logger in the initialization of my app and from now on i want every module that will require the logger will get the same instance with the same configuration options.</p>
  
  <pre><code>// index.js
  var logger = require('./app/utils/logger');
  var config = require('./app/config');
  
  config.init().then(function(configData) {
    // create the logger instance once
    var log = logger({
        name: 'appLogger'
        level: configData['log.level'],
        src: process.env.NODE_ENV === 'development',
        streams: [{
           path: path.resolve(configData['log.file']),
           type: 'file'
        }]
      });
   log.info('logger created');
  }).catch(function(err) {
    console.log(err)
  });
  </code></pre>
  
  <p>now i want that every module in my app will get the same logger instance:</p>
  
  <pre><code>// foo.js
  var log = require('./app/utils/logger');
  log.info('this should be logged in the file that was defined in index.js');
  </code></pre>
  
  <p>what is the recommended design pattern that i should implement in the logger module?</p>
  
  <pre><code>// logger.js
  var bunyan = require('bunyan');
  // bunyan.createLogger(options)
  // what should be here?
  </code></pre>