/* automatically generated by JSCoverage - do not edit */
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
if (! _$jscoverage['appenders/hookio.js']) {
  _$jscoverage['appenders/hookio.js'] = [];
  _$jscoverage['appenders/hookio.js'][1] = 0;
  _$jscoverage['appenders/hookio.js'][2] = 0;
  _$jscoverage['appenders/hookio.js'][7] = 0;
  _$jscoverage['appenders/hookio.js'][8] = 0;
  _$jscoverage['appenders/hookio.js'][9] = 0;
  _$jscoverage['appenders/hookio.js'][10] = 0;
  _$jscoverage['appenders/hookio.js'][11] = 0;
  _$jscoverage['appenders/hookio.js'][12] = 0;
  _$jscoverage['appenders/hookio.js'][13] = 0;
  _$jscoverage['appenders/hookio.js'][14] = 0;
  _$jscoverage['appenders/hookio.js'][18] = 0;
  _$jscoverage['appenders/hookio.js'][20] = 0;
  _$jscoverage['appenders/hookio.js'][21] = 0;
  _$jscoverage['appenders/hookio.js'][22] = 0;
  _$jscoverage['appenders/hookio.js'][23] = 0;
  _$jscoverage['appenders/hookio.js'][27] = 0;
  _$jscoverage['appenders/hookio.js'][28] = 0;
  _$jscoverage['appenders/hookio.js'][29] = 0;
  _$jscoverage['appenders/hookio.js'][31] = 0;
  _$jscoverage['appenders/hookio.js'][34] = 0;
  _$jscoverage['appenders/hookio.js'][36] = 0;
  _$jscoverage['appenders/hookio.js'][37] = 0;
  _$jscoverage['appenders/hookio.js'][40] = 0;
  _$jscoverage['appenders/hookio.js'][41] = 0;
  _$jscoverage['appenders/hookio.js'][42] = 0;
  _$jscoverage['appenders/hookio.js'][43] = 0;
  _$jscoverage['appenders/hookio.js'][44] = 0;
  _$jscoverage['appenders/hookio.js'][45] = 0;
  _$jscoverage['appenders/hookio.js'][47] = 0;
  _$jscoverage['appenders/hookio.js'][50] = 0;
  _$jscoverage['appenders/hookio.js'][51] = 0;
  _$jscoverage['appenders/hookio.js'][52] = 0;
  _$jscoverage['appenders/hookio.js'][54] = 0;
  _$jscoverage['appenders/hookio.js'][59] = 0;
  _$jscoverage['appenders/hookio.js'][60] = 0;
  _$jscoverage['appenders/hookio.js'][61] = 0;
  _$jscoverage['appenders/hookio.js'][62] = 0;
  _$jscoverage['appenders/hookio.js'][65] = 0;
  _$jscoverage['appenders/hookio.js'][66] = 0;
  _$jscoverage['appenders/hookio.js'][67] = 0;
  _$jscoverage['appenders/hookio.js'][68] = 0;
  _$jscoverage['appenders/hookio.js'][69] = 0;
  _$jscoverage['appenders/hookio.js'][70] = 0;
  _$jscoverage['appenders/hookio.js'][72] = 0;
  _$jscoverage['appenders/hookio.js'][75] = 0;
  _$jscoverage['appenders/hookio.js'][76] = 0;
}
_$jscoverage['appenders/hookio.js'][1]++;
"use strict";
_$jscoverage['appenders/hookio.js'][2]++;
var log4js = require("../log4js"), layouts = require("../layouts"), Hook = require("hook.io").Hook, util = require("util");
_$jscoverage['appenders/hookio.js'][7]++;
var Logger = (function createLogger(options) {
  _$jscoverage['appenders/hookio.js'][8]++;
  var self = this;
  _$jscoverage['appenders/hookio.js'][9]++;
  var actualAppender = options.actualAppender;
  _$jscoverage['appenders/hookio.js'][10]++;
  Hook.call(self, options);
  _$jscoverage['appenders/hookio.js'][11]++;
  self.on("hook::ready", (function hookReady() {
  _$jscoverage['appenders/hookio.js'][12]++;
  self.on("*::" + options.name + "::log", (function log(loggingEvent) {
  _$jscoverage['appenders/hookio.js'][13]++;
  deserializeLoggingEvent(loggingEvent);
  _$jscoverage['appenders/hookio.js'][14]++;
  actualAppender(loggingEvent);
}));
}));
});
_$jscoverage['appenders/hookio.js'][18]++;
util.inherits(Logger, Hook);
_$jscoverage['appenders/hookio.js'][20]++;
function deserializeLoggingEvent(loggingEvent) {
  _$jscoverage['appenders/hookio.js'][21]++;
  loggingEvent.startTime = new Date(loggingEvent.startTime);
  _$jscoverage['appenders/hookio.js'][22]++;
  loggingEvent.level.toString = (function levelToString() {
  _$jscoverage['appenders/hookio.js'][23]++;
  return loggingEvent.level.levelStr;
});
}
_$jscoverage['appenders/hookio.js'][27]++;
function initHook(hookioOptions) {
  _$jscoverage['appenders/hookio.js'][28]++;
  var loggerHook;
  _$jscoverage['appenders/hookio.js'][29]++;
  if (hookioOptions.mode === "master") {
    _$jscoverage['appenders/hookio.js'][31]++;
    loggerHook = new Logger(hookioOptions);
  }
  else {
    _$jscoverage['appenders/hookio.js'][34]++;
    loggerHook = new Hook(hookioOptions);
  }
  _$jscoverage['appenders/hookio.js'][36]++;
  loggerHook.start();
  _$jscoverage['appenders/hookio.js'][37]++;
  return loggerHook;
}
_$jscoverage['appenders/hookio.js'][40]++;
function getBufferedHook(hook, eventName) {
  _$jscoverage['appenders/hookio.js'][41]++;
  var hookBuffer = [];
  _$jscoverage['appenders/hookio.js'][42]++;
  var hookReady = false;
  _$jscoverage['appenders/hookio.js'][43]++;
  hook.on("hook::ready", (function emptyBuffer() {
  _$jscoverage['appenders/hookio.js'][44]++;
  hookBuffer.forEach((function logBufferItem(loggingEvent) {
  _$jscoverage['appenders/hookio.js'][45]++;
  hook.emit(eventName, loggingEvent);
}));
  _$jscoverage['appenders/hookio.js'][47]++;
  hookReady = true;
}));
  _$jscoverage['appenders/hookio.js'][50]++;
  return (function log(loggingEvent) {
  _$jscoverage['appenders/hookio.js'][51]++;
  if (hookReady) {
    _$jscoverage['appenders/hookio.js'][52]++;
    hook.emit(eventName, loggingEvent);
  }
  else {
    _$jscoverage['appenders/hookio.js'][54]++;
    hookBuffer.push(loggingEvent);
  }
});
}
_$jscoverage['appenders/hookio.js'][59]++;
function createAppender(hookioOptions) {
  _$jscoverage['appenders/hookio.js'][60]++;
  var loggerHook = initHook(hookioOptions);
  _$jscoverage['appenders/hookio.js'][61]++;
  var loggerEvent = hookioOptions.name + "::log";
  _$jscoverage['appenders/hookio.js'][62]++;
  return getBufferedHook(loggerHook, loggerEvent);
}
_$jscoverage['appenders/hookio.js'][65]++;
function configure(config) {
  _$jscoverage['appenders/hookio.js'][66]++;
  var actualAppender;
  _$jscoverage['appenders/hookio.js'][67]++;
  if (config.appender && config.mode === "master") {
    _$jscoverage['appenders/hookio.js'][68]++;
    log4js.loadAppender(config.appender.type);
    _$jscoverage['appenders/hookio.js'][69]++;
    actualAppender = log4js.appenderMakers[config.appender.type](config.appender);
    _$jscoverage['appenders/hookio.js'][70]++;
    config.actualAppender = actualAppender;
  }
  _$jscoverage['appenders/hookio.js'][72]++;
  return createAppender(config);
}
_$jscoverage['appenders/hookio.js'][75]++;
exports.appender = createAppender;
_$jscoverage['appenders/hookio.js'][76]++;
exports.configure = configure;
_$jscoverage['appenders/hookio.js'].source = ["\"use strict\";","var log4js = require('../log4js')",", layouts = require('../layouts')",", Hook = require('hook.io').Hook",", util = require('util');","","var Logger = function createLogger(options) {","  var self = this;","  var actualAppender = options.actualAppender;","  Hook.call(self, options);","  self.on('hook::ready', function hookReady() {","    self.on('*::' + options.name + '::log', function log(loggingEvent) {","      deserializeLoggingEvent(loggingEvent);","      actualAppender(loggingEvent);","    });","  });","};","util.inherits(Logger, Hook);","","function deserializeLoggingEvent(loggingEvent) {","  loggingEvent.startTime = new Date(loggingEvent.startTime);","  loggingEvent.level.toString = function levelToString() {","    return loggingEvent.level.levelStr;","  };","}","","function initHook(hookioOptions) {","  var loggerHook;","  if (hookioOptions.mode === 'master') {","    // Start the master hook, handling the actual logging","    loggerHook = new Logger(hookioOptions);","  } else {","    // Start a worker, just emitting events for a master","    loggerHook = new Hook(hookioOptions);","  }","  loggerHook.start();","  return loggerHook;","}","","function getBufferedHook(hook, eventName) {","  var hookBuffer = [];","  var hookReady = false;","  hook.on('hook::ready', function emptyBuffer() {","    hookBuffer.forEach(function logBufferItem(loggingEvent) {","      hook.emit(eventName, loggingEvent);","    });","    hookReady = true;","  });","","  return function log(loggingEvent) {","    if (hookReady) {","      hook.emit(eventName, loggingEvent);","    } else {","      hookBuffer.push(loggingEvent);","    }","  };","}","","function createAppender(hookioOptions) {","  var loggerHook = initHook(hookioOptions);","  var loggerEvent = hookioOptions.name + '::log';","  return getBufferedHook(loggerHook, loggerEvent);","}","","function configure(config) {","  var actualAppender;","  if (config.appender &amp;&amp; config.mode === 'master') {","    log4js.loadAppender(config.appender.type);","    actualAppender = log4js.appenderMakers[config.appender.type](config.appender);","    config.actualAppender = actualAppender;","  }","  return createAppender(config);","}","","exports.appender = createAppender;","exports.configure = configure;"];
