/* automatically generated by JSCoverage - do not edit */
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
if (! _$jscoverage['log4js.js']) {
  _$jscoverage['log4js.js'] = [];
  _$jscoverage['log4js.js'][1] = 0;
  _$jscoverage['log4js.js'][46] = 0;
  _$jscoverage['log4js.js'][71] = 0;
  _$jscoverage['log4js.js'][74] = 0;
  _$jscoverage['log4js.js'][75] = 0;
  _$jscoverage['log4js.js'][78] = 0;
  _$jscoverage['log4js.js'][79] = 0;
  _$jscoverage['log4js.js'][81] = 0;
  _$jscoverage['log4js.js'][82] = 0;
  _$jscoverage['log4js.js'][83] = 0;
  _$jscoverage['log4js.js'][84] = 0;
  _$jscoverage['log4js.js'][85] = 0;
  _$jscoverage['log4js.js'][88] = 0;
  _$jscoverage['log4js.js'][89] = 0;
  _$jscoverage['log4js.js'][90] = 0;
  _$jscoverage['log4js.js'][91] = 0;
  _$jscoverage['log4js.js'][96] = 0;
  _$jscoverage['log4js.js'][102] = 0;
  _$jscoverage['log4js.js'][103] = 0;
  _$jscoverage['log4js.js'][104] = 0;
  _$jscoverage['log4js.js'][105] = 0;
  _$jscoverage['log4js.js'][106] = 0;
  _$jscoverage['log4js.js'][109] = 0;
  _$jscoverage['log4js.js'][110] = 0;
  _$jscoverage['log4js.js'][113] = 0;
  _$jscoverage['log4js.js'][114] = 0;
  _$jscoverage['log4js.js'][116] = 0;
  _$jscoverage['log4js.js'][117] = 0;
  _$jscoverage['log4js.js'][118] = 0;
  _$jscoverage['log4js.js'][119] = 0;
  _$jscoverage['log4js.js'][124] = 0;
  _$jscoverage['log4js.js'][125] = 0;
  _$jscoverage['log4js.js'][126] = 0;
  _$jscoverage['log4js.js'][127] = 0;
  _$jscoverage['log4js.js'][132] = 0;
  _$jscoverage['log4js.js'][133] = 0;
  _$jscoverage['log4js.js'][134] = 0;
  _$jscoverage['log4js.js'][136] = 0;
  _$jscoverage['log4js.js'][139] = 0;
  _$jscoverage['log4js.js'][140] = 0;
  _$jscoverage['log4js.js'][141] = 0;
  _$jscoverage['log4js.js'][142] = 0;
  _$jscoverage['log4js.js'][143] = 0;
  _$jscoverage['log4js.js'][148] = 0;
  _$jscoverage['log4js.js'][149] = 0;
  _$jscoverage['log4js.js'][150] = 0;
  _$jscoverage['log4js.js'][151] = 0;
  _$jscoverage['log4js.js'][152] = 0;
  _$jscoverage['log4js.js'][153] = 0;
  _$jscoverage['log4js.js'][154] = 0;
  _$jscoverage['log4js.js'][155] = 0;
  _$jscoverage['log4js.js'][156] = 0;
  _$jscoverage['log4js.js'][157] = 0;
  _$jscoverage['log4js.js'][159] = 0;
  _$jscoverage['log4js.js'][165] = 0;
  _$jscoverage['log4js.js'][166] = 0;
  _$jscoverage['log4js.js'][167] = 0;
  _$jscoverage['log4js.js'][168] = 0;
  _$jscoverage['log4js.js'][169] = 0;
  _$jscoverage['log4js.js'][175] = 0;
  _$jscoverage['log4js.js'][176] = 0;
  _$jscoverage['log4js.js'][184] = 0;
  _$jscoverage['log4js.js'][185] = 0;
  _$jscoverage['log4js.js'][188] = 0;
  _$jscoverage['log4js.js'][190] = 0;
  _$jscoverage['log4js.js'][191] = 0;
  _$jscoverage['log4js.js'][192] = 0;
  _$jscoverage['log4js.js'][194] = 0;
  _$jscoverage['log4js.js'][197] = 0;
  _$jscoverage['log4js.js'][198] = 0;
  _$jscoverage['log4js.js'][199] = 0;
  _$jscoverage['log4js.js'][200] = 0;
  _$jscoverage['log4js.js'][201] = 0;
  _$jscoverage['log4js.js'][203] = 0;
  _$jscoverage['log4js.js'][204] = 0;
  _$jscoverage['log4js.js'][206] = 0;
  _$jscoverage['log4js.js'][209] = 0;
  _$jscoverage['log4js.js'][217] = 0;
  _$jscoverage['log4js.js'][218] = 0;
  _$jscoverage['log4js.js'][219] = 0;
  _$jscoverage['log4js.js'][221] = 0;
  _$jscoverage['log4js.js'][222] = 0;
  _$jscoverage['log4js.js'][224] = 0;
  _$jscoverage['log4js.js'][227] = 0;
  _$jscoverage['log4js.js'][228] = 0;
  _$jscoverage['log4js.js'][229] = 0;
  _$jscoverage['log4js.js'][230] = 0;
  _$jscoverage['log4js.js'][232] = 0;
  _$jscoverage['log4js.js'][234] = 0;
  _$jscoverage['log4js.js'][237] = 0;
  _$jscoverage['log4js.js'][238] = 0;
  _$jscoverage['log4js.js'][239] = 0;
  _$jscoverage['log4js.js'][240] = 0;
  _$jscoverage['log4js.js'][242] = 0;
  _$jscoverage['log4js.js'][243] = 0;
  _$jscoverage['log4js.js'][244] = 0;
  _$jscoverage['log4js.js'][247] = 0;
  _$jscoverage['log4js.js'][248] = 0;
  _$jscoverage['log4js.js'][249] = 0;
  _$jscoverage['log4js.js'][250] = 0;
  _$jscoverage['log4js.js'][252] = 0;
  _$jscoverage['log4js.js'][253] = 0;
  _$jscoverage['log4js.js'][254] = 0;
  _$jscoverage['log4js.js'][256] = 0;
  _$jscoverage['log4js.js'][258] = 0;
  _$jscoverage['log4js.js'][259] = 0;
  _$jscoverage['log4js.js'][264] = 0;
  _$jscoverage['log4js.js'][267] = 0;
  _$jscoverage['log4js.js'][275] = 0;
  _$jscoverage['log4js.js'][276] = 0;
  _$jscoverage['log4js.js'][277] = 0;
  _$jscoverage['log4js.js'][278] = 0;
  _$jscoverage['log4js.js'][281] = 0;
  _$jscoverage['log4js.js'][282] = 0;
  _$jscoverage['log4js.js'][283] = 0;
  _$jscoverage['log4js.js'][287] = 0;
  _$jscoverage['log4js.js'][288] = 0;
  _$jscoverage['log4js.js'][289] = 0;
  _$jscoverage['log4js.js'][293] = 0;
  _$jscoverage['log4js.js'][294] = 0;
  _$jscoverage['log4js.js'][295] = 0;
  _$jscoverage['log4js.js'][296] = 0;
  _$jscoverage['log4js.js'][298] = 0;
  _$jscoverage['log4js.js'][300] = 0;
  _$jscoverage['log4js.js'][301] = 0;
  _$jscoverage['log4js.js'][304] = 0;
  _$jscoverage['log4js.js'][326] = 0;
}
_$jscoverage['log4js.js'][1]++;
"use strict";
_$jscoverage['log4js.js'][46]++;
var events = require("events"), fs = require("fs"), path = require("path"), util = require("util"), layouts = require("./layouts"), levels = require("./levels"), LoggingEvent = require("./logger").LoggingEvent, Logger = require("./logger").Logger, ALL_CATEGORIES = "[all]", appenders = {}, loggers = {}, appenderMakers = {}, defaultConfig = {appenders: [{type: "console"}], replaceConsole: false};
_$jscoverage['log4js.js'][71]++;
function getLogger(categoryName) {
  _$jscoverage['log4js.js'][74]++;
  if (typeof categoryName !== "string") {
    _$jscoverage['log4js.js'][75]++;
    categoryName = Logger.DEFAULT_CATEGORY;
  }
  _$jscoverage['log4js.js'][78]++;
  var appenderList;
  _$jscoverage['log4js.js'][79]++;
  if (! loggers[categoryName]) {
    _$jscoverage['log4js.js'][81]++;
    loggers[categoryName] = new Logger(categoryName);
    _$jscoverage['log4js.js'][82]++;
    if (appenders[categoryName]) {
      _$jscoverage['log4js.js'][83]++;
      appenderList = appenders[categoryName];
      _$jscoverage['log4js.js'][84]++;
      appenderList.forEach((function (appender) {
  _$jscoverage['log4js.js'][85]++;
  loggers[categoryName].addListener("log", appender);
}));
    }
    _$jscoverage['log4js.js'][88]++;
    if (appenders[ALL_CATEGORIES]) {
      _$jscoverage['log4js.js'][89]++;
      appenderList = appenders[ALL_CATEGORIES];
      _$jscoverage['log4js.js'][90]++;
      appenderList.forEach((function (appender) {
  _$jscoverage['log4js.js'][91]++;
  loggers[categoryName].addListener("log", appender);
}));
    }
  }
  _$jscoverage['log4js.js'][96]++;
  return loggers[categoryName];
}
_$jscoverage['log4js.js'][102]++;
function addAppender() {
  _$jscoverage['log4js.js'][103]++;
  var args = Array.prototype.slice.call(arguments);
  _$jscoverage['log4js.js'][104]++;
  var appender = args.shift();
  _$jscoverage['log4js.js'][105]++;
  if (args.length === 0 || args[0] === undefined) {
    _$jscoverage['log4js.js'][106]++;
    args = [ALL_CATEGORIES];
  }
  _$jscoverage['log4js.js'][109]++;
  if (Array.isArray(args[0])) {
    _$jscoverage['log4js.js'][110]++;
    args = args[0];
  }
  _$jscoverage['log4js.js'][113]++;
  args.forEach((function (category) {
  _$jscoverage['log4js.js'][114]++;
  addAppenderToCategory(appender, category);
  _$jscoverage['log4js.js'][116]++;
  if (category === ALL_CATEGORIES) {
    _$jscoverage['log4js.js'][117]++;
    addAppenderToAllLoggers(appender);
  }
  else {
    _$jscoverage['log4js.js'][118]++;
    if (loggers[category]) {
      _$jscoverage['log4js.js'][119]++;
      loggers[category].addListener("log", appender);
    }
  }
}));
}
_$jscoverage['log4js.js'][124]++;
function addAppenderToAllLoggers(appender) {
  _$jscoverage['log4js.js'][125]++;
  for (var logger in loggers) {
    _$jscoverage['log4js.js'][126]++;
    if (loggers.hasOwnProperty(logger)) {
      _$jscoverage['log4js.js'][127]++;
      loggers[logger].addListener("log", appender);
    }
}
}
_$jscoverage['log4js.js'][132]++;
function addAppenderToCategory(appender, category) {
  _$jscoverage['log4js.js'][133]++;
  if (! appenders[category]) {
    _$jscoverage['log4js.js'][134]++;
    appenders[category] = [];
  }
  _$jscoverage['log4js.js'][136]++;
  appenders[category].push(appender);
}
_$jscoverage['log4js.js'][139]++;
function clearAppenders() {
  _$jscoverage['log4js.js'][140]++;
  appenders = {};
  _$jscoverage['log4js.js'][141]++;
  for (var logger in loggers) {
    _$jscoverage['log4js.js'][142]++;
    if (loggers.hasOwnProperty(logger)) {
      _$jscoverage['log4js.js'][143]++;
      loggers[logger].removeAllListeners("log");
    }
}
}
_$jscoverage['log4js.js'][148]++;
function configureAppenders(appenderList, options) {
  _$jscoverage['log4js.js'][149]++;
  clearAppenders();
  _$jscoverage['log4js.js'][150]++;
  if (appenderList) {
    _$jscoverage['log4js.js'][151]++;
    appenderList.forEach((function (appenderConfig) {
  _$jscoverage['log4js.js'][152]++;
  loadAppender(appenderConfig.type);
  _$jscoverage['log4js.js'][153]++;
  var appender;
  _$jscoverage['log4js.js'][154]++;
  appenderConfig.makers = appenderMakers;
  _$jscoverage['log4js.js'][155]++;
  try {
    _$jscoverage['log4js.js'][156]++;
    appender = appenderMakers[appenderConfig.type](appenderConfig, options);
    _$jscoverage['log4js.js'][157]++;
    addAppender(appender, appenderConfig.category);
  }
  catch (e) {
    _$jscoverage['log4js.js'][159]++;
    throw new Error("log4js configuration problem for " + util.inspect(appenderConfig), e);
  }
}));
  }
}
_$jscoverage['log4js.js'][165]++;
function configureLevels(levels) {
  _$jscoverage['log4js.js'][166]++;
  if (levels) {
    _$jscoverage['log4js.js'][167]++;
    for (var category in levels) {
      _$jscoverage['log4js.js'][168]++;
      if (levels.hasOwnProperty(category)) {
        _$jscoverage['log4js.js'][169]++;
        getLogger(category).setLevel(levels[category]);
      }
}
  }
}
_$jscoverage['log4js.js'][175]++;
function setGlobalLogLevel(level) {
  _$jscoverage['log4js.js'][176]++;
  Logger.prototype.level = levels.toLevel(level, levels.TRACE);
}
_$jscoverage['log4js.js'][184]++;
function getDefaultLogger() {
  _$jscoverage['log4js.js'][185]++;
  return getLogger(Logger.DEFAULT_CATEGORY);
}
_$jscoverage['log4js.js'][188]++;
var configState = {};
_$jscoverage['log4js.js'][190]++;
function loadConfigurationFile(filename) {
  _$jscoverage['log4js.js'][191]++;
  if (filename) {
    _$jscoverage['log4js.js'][192]++;
    return JSON.parse(fs.readFileSync(filename, "utf8"));
  }
  _$jscoverage['log4js.js'][194]++;
  return undefined;
}
_$jscoverage['log4js.js'][197]++;
function configureOnceOff(config, options) {
  _$jscoverage['log4js.js'][198]++;
  if (config) {
    _$jscoverage['log4js.js'][199]++;
    try {
      _$jscoverage['log4js.js'][200]++;
      configureAppenders(config.appenders, options);
      _$jscoverage['log4js.js'][201]++;
      configureLevels(config.levels);
      _$jscoverage['log4js.js'][203]++;
      if (config.replaceConsole) {
        _$jscoverage['log4js.js'][204]++;
        replaceConsole();
      }
      else {
        _$jscoverage['log4js.js'][206]++;
        restoreConsole();
      }
    }
    catch (e) {
      _$jscoverage['log4js.js'][209]++;
      throw new Error("Problem reading log4js config " + util.inspect(config) + ". Error was \"" + e.message + "\" (" + e.stack + ")");
    }
  }
}
_$jscoverage['log4js.js'][217]++;
function reloadConfiguration() {
  _$jscoverage['log4js.js'][218]++;
  var mtime = getMTime(configState.filename);
  _$jscoverage['log4js.js'][219]++;
  if (! mtime) {
    _$jscoverage['log4js.js'][219]++;
    return;
  }
  _$jscoverage['log4js.js'][221]++;
  if (configState.lastMTime && (mtime.getTime() > configState.lastMTime.getTime())) {
    _$jscoverage['log4js.js'][222]++;
    configureOnceOff(loadConfigurationFile(configState.filename));
  }
  _$jscoverage['log4js.js'][224]++;
  configState.lastMTime = mtime;
}
_$jscoverage['log4js.js'][227]++;
function getMTime(filename) {
  _$jscoverage['log4js.js'][228]++;
  var mtime;
  _$jscoverage['log4js.js'][229]++;
  try {
    _$jscoverage['log4js.js'][230]++;
    mtime = fs.statSync(configState.filename).mtime;
  }
  catch (e) {
    _$jscoverage['log4js.js'][232]++;
    getLogger("log4js").warn("Failed to load configuration file " + filename);
  }
  _$jscoverage['log4js.js'][234]++;
  return mtime;
}
_$jscoverage['log4js.js'][237]++;
function initReloadConfiguration(filename, options) {
  _$jscoverage['log4js.js'][238]++;
  if (configState.timerId) {
    _$jscoverage['log4js.js'][239]++;
    clearInterval(configState.timerId);
    _$jscoverage['log4js.js'][240]++;
    delete configState.timerId;
  }
  _$jscoverage['log4js.js'][242]++;
  configState.filename = filename;
  _$jscoverage['log4js.js'][243]++;
  configState.lastMTime = getMTime(filename);
  _$jscoverage['log4js.js'][244]++;
  configState.timerId = setInterval(reloadConfiguration, options.reloadSecs * 1000);
}
_$jscoverage['log4js.js'][247]++;
function configure(configurationFileOrObject, options) {
  _$jscoverage['log4js.js'][248]++;
  var config = configurationFileOrObject;
  _$jscoverage['log4js.js'][249]++;
  config = config || process.env.LOG4JS_CONFIG;
  _$jscoverage['log4js.js'][250]++;
  options = options || {};
  _$jscoverage['log4js.js'][252]++;
  if (config === undefined || config === null || typeof config === "string") {
    _$jscoverage['log4js.js'][253]++;
    if (options.reloadSecs) {
      _$jscoverage['log4js.js'][254]++;
      initReloadConfiguration(config, options);
    }
    _$jscoverage['log4js.js'][256]++;
    config = loadConfigurationFile(config) || defaultConfig;
  }
  else {
    _$jscoverage['log4js.js'][258]++;
    if (options.reloadSecs) {
      _$jscoverage['log4js.js'][259]++;
      getLogger("log4js").warn("Ignoring configuration reload parameter for \"object\" configuration.");
    }
  }
  _$jscoverage['log4js.js'][264]++;
  configureOnceOff(config, options);
}
_$jscoverage['log4js.js'][267]++;
var originalConsoleFunctions = {log: console.log, debug: console.debug, info: console.info, warn: console.warn, error: console.error};
_$jscoverage['log4js.js'][275]++;
function replaceConsole(logger) {
  _$jscoverage['log4js.js'][276]++;
  function replaceWith(fn) {
    _$jscoverage['log4js.js'][277]++;
    return (function () {
  _$jscoverage['log4js.js'][278]++;
  fn.apply(logger, arguments);
});
}
  _$jscoverage['log4js.js'][281]++;
  logger = logger || getLogger("console");
  _$jscoverage['log4js.js'][282]++;
  ["log", "debug", "info", "warn", "error"].forEach((function (item) {
  _$jscoverage['log4js.js'][283]++;
  console[item] = replaceWith(item === "log"? logger.info: logger[item]);
}));
}
_$jscoverage['log4js.js'][287]++;
function restoreConsole() {
  _$jscoverage['log4js.js'][288]++;
  ["log", "debug", "info", "warn", "error"].forEach((function (item) {
  _$jscoverage['log4js.js'][289]++;
  console[item] = originalConsoleFunctions[item];
}));
}
_$jscoverage['log4js.js'][293]++;
function loadAppender(appender) {
  _$jscoverage['log4js.js'][294]++;
  var appenderModule;
  _$jscoverage['log4js.js'][295]++;
  try {
    _$jscoverage['log4js.js'][296]++;
    appenderModule = require("./appenders/" + appender);
  }
  catch (e) {
    _$jscoverage['log4js.js'][298]++;
    appenderModule = require(appender);
  }
  _$jscoverage['log4js.js'][300]++;
  module.exports.appenders[appender] = appenderModule.appender.bind(appenderModule);
  _$jscoverage['log4js.js'][301]++;
  appenderMakers[appender] = appenderModule.configure.bind(appenderModule);
}
_$jscoverage['log4js.js'][304]++;
module.exports = {getLogger: getLogger, getDefaultLogger: getDefaultLogger, addAppender: addAppender, loadAppender: loadAppender, clearAppenders: clearAppenders, configure: configure, replaceConsole: replaceConsole, restoreConsole: restoreConsole, levels: levels, setGlobalLogLevel: setGlobalLogLevel, layouts: layouts, appenders: {}, appenderMakers: appenderMakers, connectLogger: require("./connect-logger").connectLogger};
_$jscoverage['log4js.js'][326]++;
configure();
_$jscoverage['log4js.js'].source = ["\"use strict\";","/*"," * Licensed under the Apache License, Version 2.0 (the \"License\");"," * you may not use this file except in compliance with the License."," * You may obtain a copy of the License at"," *"," *      http://www.apache.org/licenses/LICENSE-2.0"," *"," * Unless required by applicable law or agreed to in writing, software"," * distributed under the License is distributed on an \"AS IS\" BASIS,"," * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied."," * See the License for the specific language governing permissions and"," * limitations under the License."," */","","/**"," * @fileoverview log4js is a library to log in JavaScript in similar manner"," * than in log4j for Java. The API should be nearly the same."," *"," * &lt;h3&gt;Example:&lt;/h3&gt;"," * &lt;pre&gt;"," *  var logging = require('log4js');"," *  //add an appender that logs all messages to stdout."," *  logging.addAppender(logging.consoleAppender());"," *  //add an appender that logs \"some-category\" to a file"," *  logging.addAppender(logging.fileAppender(\"file.log\"), \"some-category\");"," *  //get a logger"," *  var log = logging.getLogger(\"some-category\");"," *  log.setLevel(logging.levels.TRACE); //set the Level"," *"," *  ..."," *"," *  //call the log"," *  log.trace(\"trace me\" );"," * &lt;/pre&gt;"," *"," * NOTE: the authors below are the original browser-based log4js authors"," * don't try to contact them about bugs in this version :)"," * @version 1.0"," * @author Stephan Strittmatter - http://jroller.com/page/stritti"," * @author Seth Chisamore - http://www.chisamore.com"," * @since 2005-05-20"," * @static"," * Website: http://log4js.berlios.de"," */","var events = require('events')",", fs = require('fs')",", path = require('path')",", util = require('util')",", layouts = require('./layouts')",", levels = require('./levels')",", LoggingEvent = require('./logger').LoggingEvent",", Logger = require('./logger').Logger",", ALL_CATEGORIES = '[all]'",", appenders = {}",", loggers = {}",", appenderMakers = {}",", defaultConfig =   {","  appenders: [","    { type: \"console\" }","  ],","  replaceConsole: false","};","","/**"," * Get a logger instance. Instance is cached on categoryName level."," * @param  {String} categoryName name of category to log to."," * @return {Logger} instance of logger for the category"," * @static"," */","function getLogger (categoryName) {","","  // Use default logger if categoryName is not specified or invalid","  if (typeof categoryName !== \"string\") {","    categoryName = Logger.DEFAULT_CATEGORY;","  }","","  var appenderList;","  if (!loggers[categoryName]) {","    // Create the logger for this name if it doesn't already exist","    loggers[categoryName] = new Logger(categoryName);","    if (appenders[categoryName]) {","      appenderList = appenders[categoryName];","      appenderList.forEach(function(appender) {","        loggers[categoryName].addListener(\"log\", appender);","      });","    }","    if (appenders[ALL_CATEGORIES]) {","      appenderList = appenders[ALL_CATEGORIES];","      appenderList.forEach(function(appender) {","        loggers[categoryName].addListener(\"log\", appender);","      });","    }","  }","  ","  return loggers[categoryName];","}","","/**"," * args are appender, then zero or more categories"," */","function addAppender () {","  var args = Array.prototype.slice.call(arguments);","  var appender = args.shift();","  if (args.length === 0 || args[0] === undefined) {","    args = [ ALL_CATEGORIES ];","  }","  //argument may already be an array","  if (Array.isArray(args[0])) {","    args = args[0];","  }","  ","  args.forEach(function(category) {","    addAppenderToCategory(appender, category);","    ","    if (category === ALL_CATEGORIES) {","      addAppenderToAllLoggers(appender);","    } else if (loggers[category]) {","      loggers[category].addListener(\"log\", appender);","    }","  });","}","","function addAppenderToAllLoggers(appender) {","  for (var logger in loggers) {","    if (loggers.hasOwnProperty(logger)) {","      loggers[logger].addListener(\"log\", appender);","    }","  }","}","","function addAppenderToCategory(appender, category) {","  if (!appenders[category]) {","    appenders[category] = [];","  }","  appenders[category].push(appender);","}","","function clearAppenders () {","  appenders = {};","  for (var logger in loggers) {","    if (loggers.hasOwnProperty(logger)) {","      loggers[logger].removeAllListeners(\"log\");","    }","  }","}","","function configureAppenders(appenderList, options) {","  clearAppenders();","  if (appenderList) {","    appenderList.forEach(function(appenderConfig) {","      loadAppender(appenderConfig.type);","      var appender;","      appenderConfig.makers = appenderMakers;","      try {","        appender = appenderMakers[appenderConfig.type](appenderConfig, options);","        addAppender(appender, appenderConfig.category);","      } catch(e) {","        throw new Error(\"log4js configuration problem for \" + util.inspect(appenderConfig), e);","      }","    });","  }","}","","function configureLevels(levels) {","  if (levels) {","    for (var category in levels) {","      if (levels.hasOwnProperty(category)) {","        getLogger(category).setLevel(levels[category]);","      }","    }","  }","}","","function setGlobalLogLevel(level) {","  Logger.prototype.level = levels.toLevel(level, levels.TRACE);","}","","/**"," * Get the default logger instance."," * @return {Logger} instance of default logger"," * @static"," */","function getDefaultLogger () {","  return getLogger(Logger.DEFAULT_CATEGORY);","}","","var configState = {};","","function loadConfigurationFile(filename) {","  if (filename) {","    return JSON.parse(fs.readFileSync(filename, \"utf8\"));","  }","  return undefined;","}","","function configureOnceOff(config, options) {","  if (config) {","    try {","      configureAppenders(config.appenders, options);","      configureLevels(config.levels);","      ","      if (config.replaceConsole) {","        replaceConsole();","      } else {","        restoreConsole();","      }","    } catch (e) {","      throw new Error(","        \"Problem reading log4js config \" + util.inspect(config) + ","          \". Error was \\\"\" + e.message + \"\\\" (\" + e.stack + \")\"","      );","    }","  }","}","","function reloadConfiguration() {","  var mtime = getMTime(configState.filename);","  if (!mtime) return;","","  if (configState.lastMTime &amp;&amp; (mtime.getTime() &gt; configState.lastMTime.getTime())) {","    configureOnceOff(loadConfigurationFile(configState.filename));","  }","  configState.lastMTime = mtime;","}","","function getMTime(filename) {","  var mtime;","  try {","    mtime = fs.statSync(configState.filename).mtime;","  } catch (e) {","    getLogger('log4js').warn('Failed to load configuration file ' + filename);","  }","  return mtime;","}","","function initReloadConfiguration(filename, options) {","  if (configState.timerId) {","    clearInterval(configState.timerId);","    delete configState.timerId;","  }","  configState.filename = filename;","  configState.lastMTime = getMTime(filename);","  configState.timerId = setInterval(reloadConfiguration, options.reloadSecs*1000);","}","","function configure(configurationFileOrObject, options) {","  var config = configurationFileOrObject;","  config = config || process.env.LOG4JS_CONFIG;","  options = options || {};","  ","  if (config === undefined || config === null || typeof(config) === 'string') {","    if (options.reloadSecs) {","      initReloadConfiguration(config, options);","    }","    config = loadConfigurationFile(config) || defaultConfig;","  } else {","    if (options.reloadSecs) {","      getLogger('log4js').warn(","        'Ignoring configuration reload parameter for \"object\" configuration.'","      );","    }","  }","  configureOnceOff(config, options);","}","","var originalConsoleFunctions = {","  log: console.log,","  debug: console.debug,","  info: console.info,","  warn: console.warn,","  error: console.error","};","","function replaceConsole(logger) {","  function replaceWith(fn) {","    return function() {","      fn.apply(logger, arguments);","    };","  }","  logger = logger || getLogger(\"console\");","  ['log','debug','info','warn','error'].forEach(function (item) {","    console[item] = replaceWith(item === 'log' ? logger.info : logger[item]);","  });","}","","function restoreConsole() {","  ['log', 'debug', 'info', 'warn', 'error'].forEach(function (item) {","    console[item] = originalConsoleFunctions[item];","  });","}","","function loadAppender(appender) {","  var appenderModule;","  try {","    appenderModule = require('./appenders/' + appender);","  } catch (e) {","    appenderModule = require(appender);","  }","  module.exports.appenders[appender] = appenderModule.appender.bind(appenderModule);","  appenderMakers[appender] = appenderModule.configure.bind(appenderModule);","}","","module.exports = {","  getLogger: getLogger,","  getDefaultLogger: getDefaultLogger,","  ","  addAppender: addAppender,","  loadAppender: loadAppender,","  clearAppenders: clearAppenders,","  configure: configure,","  ","  replaceConsole: replaceConsole,","  restoreConsole: restoreConsole,","  ","  levels: levels,","  setGlobalLogLevel: setGlobalLogLevel,","  ","  layouts: layouts,","  appenders: {},","  appenderMakers: appenderMakers,","  connectLogger: require('./connect-logger').connectLogger","};","","//set ourselves up","configure();",""];
