# Code coverage report for lib/logging.js

## Statements: 100% (12 / 12) Branches: 100% (6 / 6) Functions: 100% (2 / 2) Lines: 100% (9 / 9) Ignored: 2 statements, 2 branches

All files » lib/ » logging.js

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    231

    1

    1

    1

    1

    1
    2
    1

    1

     var util = require('util');

    var bunyan = require('bunyan');

    // Create a default logger to use if all else fails.
    module.exports = bunyan.createLogger({name: 'git2consul'});

    // Init the logger with a configuration object
    /* istanbul ignore next */
    module.exports.init = function(config) {

      // If no logger is defined in the config, there's nothing more to do.  We'll just continue using the
      // default logger.
      Iif (!config.logger) return;

      config.logger.streams.forEach(function(stream) {
        if (stream.stream === "process.stdout") stream.stream = process.stdout;
        else Iif (stream.stream === "process.stderr") stream.stream = process.stderr;
      });

      module.exports = bunyan.createLogger(config.logger);
    };