index.js
function (options) {
  Transport.call(this, options);
  options = options || {};

  this.json         = options.json        || false;
  this.colorize     = options.colorize    || false;
  this.prettyPrint  = options.prettyPrint || false;
  this.timestamp    = typeof options.timestamp !== 'undefined' ? options.timestamp : false;
  this.showLevel    = options.showLevel === undefined ? true : options.showLevel;
  this.label        = options.label       || null;
  this.logstash     = options.logstash    || false;
  this.depth        = options.depth       || null;
  this.align        = options.align       || false;
  this.stderrLevels = setStderrLevels(options.stderrLevels, options.debugStdout);
  this.warnLevels   = setWarnLevels(options.warnLevels);
  this.infoLevels   = setInfoLevels(options.infoLevels);
  this.eol          = options.eol   || os.EOL;
  this.console      = options.console     || console;

  if (this.json) {
    this.stringify = options.stringify || function (obj) {
      return JSON.stringify(obj, null, 2);
    };
  }

  //
  // Convert stderrLevels into an Object for faster key-lookup times than an Array.
  //
  // For backwards compatibility, stderrLevels defaults to ['error', 'debug']
  // or ['error'] depending on whether options.debugStdout is true.
  //
  function setStderrLevels (levels, debugStdout) {
    var defaultMsg = 'Cannot have non-string elements in stderrLevels Array';
    if (debugStdout) {
      if (levels) {
        //
        // Don't allow setting both debugStdout and stderrLevels together,
        // since this could cause behaviour a programmer might not expect.
        //
        throw new Error('Cannot set debugStdout and stderrLevels together');
      }

      return common.stringArrayToSet(['error'], defaultMsg);
    }

    if (!levels) {
      return common.stringArrayToSet(['error', 'debug'], defaultMsg);
    } else if (!(Array.isArray(levels))) {
      throw new Error('Cannot set stderrLevels to type other than Array');
    }

    return common.stringArrayToSet(levels, defaultMsg);
  };

  function setWarnLevels (levels) {
    var defaultMsg = 'Cannot have non-string elements in warnLevels Array';

    if (!levels) {
      return common.stringArrayToSet(['warn'], defaultMsg);
    } else if (!(Array.isArray(levels))) {
      throw new Error('Cannot set warnLevels to type other than Array');
    }

    return common.stringArrayToSet(levels, defaultMsg);
  };

  function setInfoLevels (levels) {
    var defaultMsg = 'Cannot have non-string elements in infoLevels Array';

    if (!levels) {
      return common.stringArrayToSet(['info'], defaultMsg);
    } else if (!(Array.isArray(levels))) {
      throw new Error('Cannot set infoLevels to type other than Array');
    }

    return common.stringArrayToSet(levels, defaultMsg);
  };
}
function (options) {
  Transport.call(this, options);
  options = options || {};

  this.json         = options.json        || false;
  this.colorize     = options.colorize    || false;
  this.prettyPrint  = options.prettyPrint || false;
  this.timestamp    = typeof options.timestamp !== 'undefined' ? options.timestamp : false;
  this.showLevel    = options.showLevel === undefined ? true : options.showLevel;
  this.label        = options.label       || null;
  this.logstash     = options.logstash    || false;
  this.depth        = options.depth       || null;
  this.align        = options.align       || false;
  this.stderrLevels = setStderrLevels(options.stderrLevels, options.debugStdout);
  this.warnLevels   = setWarnLevels(options.warnLevels);
  this.infoLevels   = setInfoLevels(options.infoLevels);
  this.eol          = options.eol   || os.EOL;
  this.console      = options.console     || console;

  if (this.json) {
    this.stringify = options.stringify || function (obj) {
      return JSON.stringify(obj, null, 2);
    };
  }

  //
  // Convert stderrLevels into an Object for faster key-lookup times than an Array.
  //
  // For backwards compatibility, stderrLevels defaults to ['error', 'debug']
  // or ['error'] depending on whether options.debugStdout is true.
  //
  function setStderrLevels (levels, debugStdout) {
    var defaultMsg = 'Cannot have non-string elements in stderrLevels Array';
    if (debugStdout) {
      if (levels) {
        //
        // Don't allow setting both debugStdout and stderrLevels together,
        // since this could cause behaviour a programmer might not expect.
        //
        throw new Error('Cannot set debugStdout and stderrLevels together');
      }

      return common.stringArrayToSet(['error'], defaultMsg);
    }

    if (!levels) {
      return common.stringArrayToSet(['error', 'debug'], defaultMsg);
    } else if (!(Array.isArray(levels))) {
      throw new Error('Cannot set stderrLevels to type other than Array');
    }

    return common.stringArrayToSet(levels, defaultMsg);
  };

  function setWarnLevels (levels) {
    var defaultMsg = 'Cannot have non-string elements in warnLevels Array';

    if (!levels) {
      return common.stringArrayToSet(['warn'], defaultMsg);
    } else if (!(Array.isArray(levels))) {
      throw new Error('Cannot set warnLevels to type other than Array');
    }

    return common.stringArrayToSet(levels, defaultMsg);
  };

  function setInfoLevels (levels) {
    var defaultMsg = 'Cannot have non-string elements in infoLevels Array';

    if (!levels) {
      return common.stringArrayToSet(['info'], defaultMsg);
    } else if (!(Array.isArray(levels))) {
      throw new Error('Cannot set infoLevels to type other than Array');
    }

    return common.stringArrayToSet(levels, defaultMsg);
  };
}
### function Console (options) #### @options {Object} Options for this instance. Constructor function for the Console transport object responsible for persisting log messages and metadata to a terminal or TTY.