/* automatically generated by JSCoverage - do not edit */
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
if (! _$jscoverage['layouts.js']) {
  _$jscoverage['layouts.js'] = [];
  _$jscoverage['layouts.js'][1] = 0;
  _$jscoverage['layouts.js'][2] = 0;
  _$jscoverage['layouts.js'][8] = 0;
  _$jscoverage['layouts.js'][9] = 0;
  _$jscoverage['layouts.js'][10] = 0;
  _$jscoverage['layouts.js'][11] = 0;
  _$jscoverage['layouts.js'][13] = 0;
  _$jscoverage['layouts.js'][27] = 0;
  _$jscoverage['layouts.js'][28] = 0;
  _$jscoverage['layouts.js'][29] = 0;
  _$jscoverage['layouts.js'][30] = 0;
  _$jscoverage['layouts.js'][32] = 0;
  _$jscoverage['layouts.js'][37] = 0;
  _$jscoverage['layouts.js'][38] = 0;
  _$jscoverage['layouts.js'][39] = 0;
  _$jscoverage['layouts.js'][42] = 0;
  _$jscoverage['layouts.js'][61] = 0;
  _$jscoverage['layouts.js'][62] = 0;
  _$jscoverage['layouts.js'][64] = 0;
  _$jscoverage['layouts.js'][65] = 0;
  _$jscoverage['layouts.js'][70] = 0;
  _$jscoverage['layouts.js'][71] = 0;
  _$jscoverage['layouts.js'][74] = 0;
  _$jscoverage['layouts.js'][75] = 0;
  _$jscoverage['layouts.js'][84] = 0;
  _$jscoverage['layouts.js'][96] = 0;
  _$jscoverage['layouts.js'][97] = 0;
  _$jscoverage['layouts.js'][104] = 0;
  _$jscoverage['layouts.js'][105] = 0;
  _$jscoverage['layouts.js'][111] = 0;
  _$jscoverage['layouts.js'][112] = 0;
  _$jscoverage['layouts.js'][144] = 0;
  _$jscoverage['layouts.js'][145] = 0;
  _$jscoverage['layouts.js'][146] = 0;
  _$jscoverage['layouts.js'][148] = 0;
  _$jscoverage['layouts.js'][150] = 0;
  _$jscoverage['layouts.js'][151] = 0;
  _$jscoverage['layouts.js'][152] = 0;
  _$jscoverage['layouts.js'][153] = 0;
  _$jscoverage['layouts.js'][154] = 0;
  _$jscoverage['layouts.js'][155] = 0;
  _$jscoverage['layouts.js'][156] = 0;
  _$jscoverage['layouts.js'][159] = 0;
  _$jscoverage['layouts.js'][162] = 0;
  _$jscoverage['layouts.js'][163] = 0;
  _$jscoverage['layouts.js'][164] = 0;
  _$jscoverage['layouts.js'][165] = 0;
  _$jscoverage['layouts.js'][167] = 0;
  _$jscoverage['layouts.js'][168] = 0;
  _$jscoverage['layouts.js'][169] = 0;
  _$jscoverage['layouts.js'][170] = 0;
  _$jscoverage['layouts.js'][171] = 0;
  _$jscoverage['layouts.js'][172] = 0;
  _$jscoverage['layouts.js'][176] = 0;
  _$jscoverage['layouts.js'][179] = 0;
  _$jscoverage['layouts.js'][180] = 0;
  _$jscoverage['layouts.js'][183] = 0;
  _$jscoverage['layouts.js'][184] = 0;
  _$jscoverage['layouts.js'][187] = 0;
  _$jscoverage['layouts.js'][188] = 0;
  _$jscoverage['layouts.js'][191] = 0;
  _$jscoverage['layouts.js'][192] = 0;
  _$jscoverage['layouts.js'][195] = 0;
  _$jscoverage['layouts.js'][196] = 0;
  _$jscoverage['layouts.js'][199] = 0;
  _$jscoverage['layouts.js'][200] = 0;
  _$jscoverage['layouts.js'][203] = 0;
  _$jscoverage['layouts.js'][204] = 0;
  _$jscoverage['layouts.js'][207] = 0;
  _$jscoverage['layouts.js'][208] = 0;
  _$jscoverage['layouts.js'][209] = 0;
  _$jscoverage['layouts.js'][210] = 0;
  _$jscoverage['layouts.js'][212] = 0;
  _$jscoverage['layouts.js'][215] = 0;
  _$jscoverage['layouts.js'][218] = 0;
  _$jscoverage['layouts.js'][231] = 0;
  _$jscoverage['layouts.js'][232] = 0;
  _$jscoverage['layouts.js'][235] = 0;
  _$jscoverage['layouts.js'][236] = 0;
  _$jscoverage['layouts.js'][237] = 0;
  _$jscoverage['layouts.js'][238] = 0;
  _$jscoverage['layouts.js'][239] = 0;
  _$jscoverage['layouts.js'][242] = 0;
  _$jscoverage['layouts.js'][245] = 0;
  _$jscoverage['layouts.js'][246] = 0;
  _$jscoverage['layouts.js'][247] = 0;
  _$jscoverage['layouts.js'][248] = 0;
  _$jscoverage['layouts.js'][249] = 0;
  _$jscoverage['layouts.js'][251] = 0;
  _$jscoverage['layouts.js'][252] = 0;
  _$jscoverage['layouts.js'][255] = 0;
  _$jscoverage['layouts.js'][257] = 0;
  _$jscoverage['layouts.js'][258] = 0;
  _$jscoverage['layouts.js'][262] = 0;
  _$jscoverage['layouts.js'][265] = 0;
  _$jscoverage['layouts.js'][266] = 0;
  _$jscoverage['layouts.js'][267] = 0;
  _$jscoverage['layouts.js'][268] = 0;
  _$jscoverage['layouts.js'][270] = 0;
  _$jscoverage['layouts.js'][271] = 0;
  _$jscoverage['layouts.js'][272] = 0;
  _$jscoverage['layouts.js'][273] = 0;
  _$jscoverage['layouts.js'][274] = 0;
  _$jscoverage['layouts.js'][275] = 0;
  _$jscoverage['layouts.js'][276] = 0;
  _$jscoverage['layouts.js'][279] = 0;
  _$jscoverage['layouts.js'][280] = 0;
  _$jscoverage['layouts.js'][284] = 0;
  _$jscoverage['layouts.js'][290] = 0;
  _$jscoverage['layouts.js'][291] = 0;
  _$jscoverage['layouts.js'][292] = 0;
  _$jscoverage['layouts.js'][294] = 0;
  _$jscoverage['layouts.js'][296] = 0;
  _$jscoverage['layouts.js'][301] = 0;
  _$jscoverage['layouts.js'][308] = 0;
}
_$jscoverage['layouts.js'][1]++;
"use strict";
_$jscoverage['layouts.js'][2]++;
var dateFormat = require("./date_format"), os = require("os"), eol = os.EOL || "\n", util = require("util"), replacementRegExp = /%[sdj]/g, layoutMakers = {"messagePassThrough": (function () {
  _$jscoverage['layouts.js'][8]++;
  return messagePassThroughLayout;
}), "basic": (function () {
  _$jscoverage['layouts.js'][9]++;
  return basicLayout;
}), "colored": (function () {
  _$jscoverage['layouts.js'][10]++;
  return colouredLayout;
}), "coloured": (function () {
  _$jscoverage['layouts.js'][11]++;
  return colouredLayout;
}), "pattern": (function (config) {
  _$jscoverage['layouts.js'][13]++;
  return patternLayout(config && config.pattern, config && config.tokens);
})}, colours = {ALL: "grey", TRACE: "blue", DEBUG: "cyan", INFO: "green", WARN: "yellow", ERROR: "red", FATAL: "magenta", OFF: "grey"};
_$jscoverage['layouts.js'][27]++;
function wrapErrorsWithInspect(items) {
  _$jscoverage['layouts.js'][28]++;
  return items.map((function (item) {
  _$jscoverage['layouts.js'][29]++;
  if ((item instanceof Error) && item.stack) {
    _$jscoverage['layouts.js'][30]++;
    return ({inspect: (function () {
  _$jscoverage['layouts.js'][30]++;
  return util.format(item) + "\n" + item.stack;
})});
  }
  else {
    _$jscoverage['layouts.js'][32]++;
    return item;
  }
}));
}
_$jscoverage['layouts.js'][37]++;
function formatLogData(logData) {
  _$jscoverage['layouts.js'][38]++;
  var data = Array.isArray(logData)? logData: Array.prototype.slice.call(arguments);
  _$jscoverage['layouts.js'][39]++;
  return util.format.apply(util, wrapErrorsWithInspect(data));
}
_$jscoverage['layouts.js'][42]++;
var styles = {"bold": [1, 22], "italic": [3, 23], "underline": [4, 24], "inverse": [7, 27], "white": [37, 39], "grey": [90, 39], "black": [90, 39], "blue": [34, 39], "cyan": [36, 39], "green": [32, 39], "magenta": [35, 39], "red": [31, 39], "yellow": [33, 39]};
_$jscoverage['layouts.js'][61]++;
function colorizeStart(style) {
  _$jscoverage['layouts.js'][62]++;
  return style? "\u001b[" + styles[style][0] + "m": "";
}
_$jscoverage['layouts.js'][64]++;
function colorizeEnd(style) {
  _$jscoverage['layouts.js'][65]++;
  return style? "\u001b[" + styles[style][1] + "m": "";
}
_$jscoverage['layouts.js'][70]++;
function colorize(str, style) {
  _$jscoverage['layouts.js'][71]++;
  return colorizeStart(style) + str + colorizeEnd(style);
}
_$jscoverage['layouts.js'][74]++;
function timestampLevelAndCategory(loggingEvent, colour) {
  _$jscoverage['layouts.js'][75]++;
  var output = colorize(formatLogData("[%s] [%s] %s - ", dateFormat.asString(loggingEvent.startTime), loggingEvent.level, loggingEvent.categoryName), colour);
  _$jscoverage['layouts.js'][84]++;
  return output;
}
_$jscoverage['layouts.js'][96]++;
function basicLayout(loggingEvent) {
  _$jscoverage['layouts.js'][97]++;
  return timestampLevelAndCategory(loggingEvent) + formatLogData(loggingEvent.data);
}
_$jscoverage['layouts.js'][104]++;
function colouredLayout(loggingEvent) {
  _$jscoverage['layouts.js'][105]++;
  return timestampLevelAndCategory(loggingEvent, colours[loggingEvent.level.toString()]) + formatLogData(loggingEvent.data);
}
_$jscoverage['layouts.js'][111]++;
function messagePassThroughLayout(loggingEvent) {
  _$jscoverage['layouts.js'][112]++;
  return formatLogData(loggingEvent.data);
}
_$jscoverage['layouts.js'][144]++;
function patternLayout(pattern, tokens) {
  _$jscoverage['layouts.js'][145]++;
  var TTCC_CONVERSION_PATTERN = "%r %p %c - %m%n";
  _$jscoverage['layouts.js'][146]++;
  var regex = /%(-?[0-9]+)?(\.?[0-9]+)?([\[\]cdmnprx%])(\{([^\}]+)\})?|([^%]+)/;
  _$jscoverage['layouts.js'][148]++;
  pattern = pattern || TTCC_CONVERSION_PATTERN;
  _$jscoverage['layouts.js'][150]++;
  function categoryName(loggingEvent, specifier) {
    _$jscoverage['layouts.js'][151]++;
    var loggerName = loggingEvent.categoryName;
    _$jscoverage['layouts.js'][152]++;
    if (specifier) {
      _$jscoverage['layouts.js'][153]++;
      var precision = parseInt(specifier, 10);
      _$jscoverage['layouts.js'][154]++;
      var loggerNameBits = loggerName.split(".");
      _$jscoverage['layouts.js'][155]++;
      if (precision < loggerNameBits.length) {
        _$jscoverage['layouts.js'][156]++;
        loggerName = loggerNameBits.slice(loggerNameBits.length - precision).join(".");
      }
    }
    _$jscoverage['layouts.js'][159]++;
    return loggerName;
}
  _$jscoverage['layouts.js'][162]++;
  function formatAsDate(loggingEvent, specifier) {
    _$jscoverage['layouts.js'][163]++;
    var format = dateFormat.ISO8601_FORMAT;
    _$jscoverage['layouts.js'][164]++;
    if (specifier) {
      _$jscoverage['layouts.js'][165]++;
      format = specifier;
      _$jscoverage['layouts.js'][167]++;
      if (format == "ISO8601") {
        _$jscoverage['layouts.js'][168]++;
        format = dateFormat.ISO8601_FORMAT;
      }
      else {
        _$jscoverage['layouts.js'][169]++;
        if (format == "ABSOLUTE") {
          _$jscoverage['layouts.js'][170]++;
          format = dateFormat.ABSOLUTETIME_FORMAT;
        }
        else {
          _$jscoverage['layouts.js'][171]++;
          if (format == "DATE") {
            _$jscoverage['layouts.js'][172]++;
            format = dateFormat.DATETIME_FORMAT;
          }
        }
      }
    }
    _$jscoverage['layouts.js'][176]++;
    return dateFormat.asString(format, loggingEvent.startTime);
}
  _$jscoverage['layouts.js'][179]++;
  function formatMessage(loggingEvent) {
    _$jscoverage['layouts.js'][180]++;
    return formatLogData(loggingEvent.data);
}
  _$jscoverage['layouts.js'][183]++;
  function endOfLine() {
    _$jscoverage['layouts.js'][184]++;
    return eol;
}
  _$jscoverage['layouts.js'][187]++;
  function logLevel(loggingEvent) {
    _$jscoverage['layouts.js'][188]++;
    return loggingEvent.level.toString();
}
  _$jscoverage['layouts.js'][191]++;
  function startTime(loggingEvent) {
    _$jscoverage['layouts.js'][192]++;
    return "" + loggingEvent.startTime.toLocaleTimeString();
}
  _$jscoverage['layouts.js'][195]++;
  function startColour(loggingEvent) {
    _$jscoverage['layouts.js'][196]++;
    return colorizeStart(colours[loggingEvent.level.toString()]);
}
  _$jscoverage['layouts.js'][199]++;
  function endColour(loggingEvent) {
    _$jscoverage['layouts.js'][200]++;
    return colorizeEnd(colours[loggingEvent.level.toString()]);
}
  _$jscoverage['layouts.js'][203]++;
  function percent() {
    _$jscoverage['layouts.js'][204]++;
    return "%";
}
  _$jscoverage['layouts.js'][207]++;
  function userDefined(loggingEvent, specifier) {
    _$jscoverage['layouts.js'][208]++;
    if (typeof tokens[specifier] !== "undefined") {
      _$jscoverage['layouts.js'][209]++;
      if (typeof tokens[specifier] === "function") {
        _$jscoverage['layouts.js'][210]++;
        return tokens[specifier](loggingEvent);
      }
      else {
        _$jscoverage['layouts.js'][212]++;
        return tokens[specifier];
      }
    }
    _$jscoverage['layouts.js'][215]++;
    return null;
}
  _$jscoverage['layouts.js'][218]++;
  var replacers = {"c": categoryName, "d": formatAsDate, "m": formatMessage, "n": endOfLine, "p": logLevel, "r": startTime, "[": startColour, "]": endColour, "%": percent, "x": userDefined};
  _$jscoverage['layouts.js'][231]++;
  function replaceToken(conversionCharacter, loggingEvent, specifier) {
    _$jscoverage['layouts.js'][232]++;
    return replacers[conversionCharacter](loggingEvent, specifier);
}
  _$jscoverage['layouts.js'][235]++;
  function truncate(truncation, toTruncate) {
    _$jscoverage['layouts.js'][236]++;
    var len;
    _$jscoverage['layouts.js'][237]++;
    if (truncation) {
      _$jscoverage['layouts.js'][238]++;
      len = parseInt(truncation.substr(1), 10);
      _$jscoverage['layouts.js'][239]++;
      return toTruncate.substring(0, len);
    }
    _$jscoverage['layouts.js'][242]++;
    return toTruncate;
}
  _$jscoverage['layouts.js'][245]++;
  function pad(padding, toPad) {
    _$jscoverage['layouts.js'][246]++;
    var len;
    _$jscoverage['layouts.js'][247]++;
    if (padding) {
      _$jscoverage['layouts.js'][248]++;
      if (padding.charAt(0) == "-") {
        _$jscoverage['layouts.js'][249]++;
        len = parseInt(padding.substr(1), 10);
        _$jscoverage['layouts.js'][251]++;
        while (toPad.length < len) {
          _$jscoverage['layouts.js'][252]++;
          toPad += " ";
}
      }
      else {
        _$jscoverage['layouts.js'][255]++;
        len = parseInt(padding, 10);
        _$jscoverage['layouts.js'][257]++;
        while (toPad.length < len) {
          _$jscoverage['layouts.js'][258]++;
          toPad = " " + toPad;
}
      }
    }
    _$jscoverage['layouts.js'][262]++;
    return toPad;
}
  _$jscoverage['layouts.js'][265]++;
  return (function (loggingEvent) {
  _$jscoverage['layouts.js'][266]++;
  var formattedString = "";
  _$jscoverage['layouts.js'][267]++;
  var result;
  _$jscoverage['layouts.js'][268]++;
  var searchString = pattern;
  _$jscoverage['layouts.js'][270]++;
  while ((result = regex.exec(searchString))) {
    _$jscoverage['layouts.js'][271]++;
    var matchedString = result[0];
    _$jscoverage['layouts.js'][272]++;
    var padding = result[1];
    _$jscoverage['layouts.js'][273]++;
    var truncation = result[2];
    _$jscoverage['layouts.js'][274]++;
    var conversionCharacter = result[3];
    _$jscoverage['layouts.js'][275]++;
    var specifier = result[5];
    _$jscoverage['layouts.js'][276]++;
    var text = result[6];
    _$jscoverage['layouts.js'][279]++;
    if (text) {
      _$jscoverage['layouts.js'][280]++;
      formattedString += "" + text;
    }
    else {
      _$jscoverage['layouts.js'][284]++;
      var replacement = replaceToken(conversionCharacter, loggingEvent, specifier) || matchedString;
      _$jscoverage['layouts.js'][290]++;
      replacement = truncate(truncation, replacement);
      _$jscoverage['layouts.js'][291]++;
      replacement = pad(padding, replacement);
      _$jscoverage['layouts.js'][292]++;
      formattedString += replacement;
    }
    _$jscoverage['layouts.js'][294]++;
    searchString = searchString.substr(result.index + result[0].length);
}
  _$jscoverage['layouts.js'][296]++;
  return formattedString;
});
}
_$jscoverage['layouts.js'][301]++;
module.exports = {basicLayout: basicLayout, messagePassThroughLayout: messagePassThroughLayout, patternLayout: patternLayout, colouredLayout: colouredLayout, coloredLayout: colouredLayout, layout: (function (name, config) {
  _$jscoverage['layouts.js'][308]++;
  return layoutMakers[name] && layoutMakers[name](config);
})};
_$jscoverage['layouts.js'].source = ["\"use strict\";","var dateFormat = require('./date_format')",", os = require('os')",", eol = os.EOL || '\\n'",", util = require('util')",", replacementRegExp = /%[sdj]/g",", layoutMakers = {","  \"messagePassThrough\": function() { return messagePassThroughLayout; }, ","  \"basic\": function() { return basicLayout; }, ","  \"colored\": function() { return colouredLayout; }, ","  \"coloured\": function() { return colouredLayout; }, ","  \"pattern\": function (config) {","    return patternLayout(config &amp;&amp; config.pattern, config &amp;&amp; config.tokens);","\t}","}",", colours = {","  ALL: \"grey\", ","  TRACE: \"blue\", ","  DEBUG: \"cyan\", ","  INFO: \"green\", ","  WARN: \"yellow\", ","  ERROR: \"red\", ","  FATAL: \"magenta\", ","  OFF: \"grey\"","};","","function wrapErrorsWithInspect(items) {","  return items.map(function(item) {","    if ((item instanceof Error) &amp;&amp; item.stack) {","      return { inspect: function() { return util.format(item) + '\\n' + item.stack; } };","    } else {","      return item;","    }","  });","}","","function formatLogData(logData) {","  var data = Array.isArray(logData) ? logData : Array.prototype.slice.call(arguments);","  return util.format.apply(util, wrapErrorsWithInspect(data));","}","","var styles = {","    //styles","  'bold'      : [1,  22],","  'italic'    : [3,  23],","  'underline' : [4,  24],","  'inverse'   : [7,  27],","  //grayscale","  'white'     : [37, 39],","  'grey'      : [90, 39],","  'black'     : [90, 39],","  //colors","  'blue'      : [34, 39],","  'cyan'      : [36, 39],","  'green'     : [32, 39],","  'magenta'   : [35, 39],","  'red'       : [31, 39],","  'yellow'    : [33, 39]","};","","function colorizeStart(style) {","  return style ? '\\x1B[' + styles[style][0] + 'm' : '';","}","function colorizeEnd(style) {","  return style ? '\\x1B[' + styles[style][1] + 'm' : '';","}","/**"," * Taken from masylum's fork (https://github.com/masylum/log4js-node)"," */","function colorize (str, style) {","  return colorizeStart(style) + str + colorizeEnd(style);","}","","function timestampLevelAndCategory(loggingEvent, colour) {","  var output = colorize(","    formatLogData(","      '[%s] [%s] %s - '","      , dateFormat.asString(loggingEvent.startTime)","      , loggingEvent.level","      , loggingEvent.categoryName","    )","    , colour","  );","  return output;","}","","/**"," * BasicLayout is a simple layout for storing the logs. The logs are stored"," * in following format:"," * &lt;pre&gt;"," * [startTime] [logLevel] categoryName - message\\n"," * &lt;/pre&gt;"," *"," * @author Stephan Strittmatter"," */","function basicLayout (loggingEvent) {","  return timestampLevelAndCategory(loggingEvent) + formatLogData(loggingEvent.data);","}","","/**"," * colouredLayout - taken from masylum's fork."," * same as basicLayout, but with colours."," */","function colouredLayout (loggingEvent) {","  return timestampLevelAndCategory(","    loggingEvent,","    colours[loggingEvent.level.toString()]","  ) + formatLogData(loggingEvent.data);","}","","function messagePassThroughLayout (loggingEvent) {","  return formatLogData(loggingEvent.data);","}","","/**"," * PatternLayout"," * Format for specifiers is %[padding].[truncation][field]{[format]}"," * e.g. %5.10p - left pad the log level by 5 characters, up to a max of 10"," * Fields can be any of:"," *  - %r time in toLocaleTimeString format"," *  - %p log level"," *  - %c log category"," *  - %m log data"," *  - %d date in various formats"," *  - %% %"," *  - %n newline"," *  - %x{&lt;tokenname&gt;} add dynamic tokens to your log. Tokens are specified in the tokens parameter"," * You can use %[ and %] to define a colored block."," *"," * Tokens are specified as simple key:value objects. "," * The key represents the token name whereas the value can be a string or function"," * which is called to extract the value to put in the log message. If token is not"," * found, it doesn't replace the field."," *"," * A sample token would be: { \"pid\" : function() { return process.pid; } }"," *"," * Takes a pattern string, array of tokens and returns a layout function."," * @param {String} Log format pattern String"," * @param {object} map object of different tokens"," * @return {Function}"," * @author Stephan Strittmatter"," * @author Jan Schmidle"," */","function patternLayout (pattern, tokens) {","  var TTCC_CONVERSION_PATTERN  = \"%r %p %c - %m%n\";","  var regex = /%(-?[0-9]+)?(\\.?[0-9]+)?([\\[\\]cdmnprx%])(\\{([^\\}]+)\\})?|([^%]+)/;","  ","  pattern = pattern || TTCC_CONVERSION_PATTERN;","","  function categoryName(loggingEvent, specifier) {","    var loggerName = loggingEvent.categoryName;","    if (specifier) {","      var precision = parseInt(specifier, 10);","      var loggerNameBits = loggerName.split(\".\");","      if (precision &lt; loggerNameBits.length) {","        loggerName = loggerNameBits.slice(loggerNameBits.length - precision).join(\".\");","      }","    }","    return loggerName;","  }","","  function formatAsDate(loggingEvent, specifier) {","    var format = dateFormat.ISO8601_FORMAT;","    if (specifier) {","      format = specifier;","      // Pick up special cases","      if (format == \"ISO8601\") {","        format = dateFormat.ISO8601_FORMAT;","      } else if (format == \"ABSOLUTE\") {","        format = dateFormat.ABSOLUTETIME_FORMAT;","      } else if (format == \"DATE\") {","        format = dateFormat.DATETIME_FORMAT;","      }","    }","    // Format the date","    return dateFormat.asString(format, loggingEvent.startTime);","  }","","  function formatMessage(loggingEvent) {","    return formatLogData(loggingEvent.data);","  }","  ","  function endOfLine() {","    return eol;","  }","","  function logLevel(loggingEvent) {","    return loggingEvent.level.toString();","  }","","  function startTime(loggingEvent) {","    return \"\" + loggingEvent.startTime.toLocaleTimeString();","  }","","  function startColour(loggingEvent) {","    return colorizeStart(colours[loggingEvent.level.toString()]);","  }","","  function endColour(loggingEvent) {","    return colorizeEnd(colours[loggingEvent.level.toString()]);","  }","","  function percent() {","    return '%';","  }","","  function userDefined(loggingEvent, specifier) {","    if (typeof(tokens[specifier]) !== 'undefined') {","      if (typeof(tokens[specifier]) === 'function') {","        return tokens[specifier](loggingEvent);","      } else {","        return tokens[specifier];","      }","    }","    return null;","  }","","  var replacers = {","    'c': categoryName,","    'd': formatAsDate,","    'm': formatMessage,","    'n': endOfLine,","    'p': logLevel,","    'r': startTime,","    '[': startColour,","    ']': endColour,","    '%': percent,","    'x': userDefined","  };","","  function replaceToken(conversionCharacter, loggingEvent, specifier) {","    return replacers[conversionCharacter](loggingEvent, specifier);","  }","","  function truncate(truncation, toTruncate) {","    var len;","    if (truncation) {","      len = parseInt(truncation.substr(1), 10);","      return toTruncate.substring(0, len);","    }","","    return toTruncate;","  }","","  function pad(padding, toPad) {","    var len;","    if (padding) {","      if (padding.charAt(0) == \"-\") {","        len = parseInt(padding.substr(1), 10);","        // Right pad with spaces","        while (toPad.length &lt; len) {","          toPad += \" \";","        }","      } else {","        len = parseInt(padding, 10);","        // Left pad with spaces","        while (toPad.length &lt; len) {","          toPad = \" \" + toPad;","        }","      }","    }","    return toPad;","  }","  ","  return function(loggingEvent) {","    var formattedString = \"\";","    var result;","    var searchString = pattern;","    ","    while ((result = regex.exec(searchString))) {","      var matchedString = result[0];","      var padding = result[1];","      var truncation = result[2];","      var conversionCharacter = result[3];","      var specifier = result[5];","      var text = result[6];","      ","      // Check if the pattern matched was just normal text","      if (text) {","        formattedString += \"\" + text;","      } else {","        // Create a raw replacement string based on the conversion","        // character and specifier","        var replacement = ","          replaceToken(conversionCharacter, loggingEvent, specifier) || ","          matchedString;","","        // Format the replacement according to any padding or","        // truncation specified","        replacement = truncate(truncation, replacement);","        replacement = pad(padding, replacement);","        formattedString += replacement;","      }","      searchString = searchString.substr(result.index + result[0].length);","    }","    return formattedString;","  };","","}","","module.exports = {","  basicLayout: basicLayout, ","  messagePassThroughLayout: messagePassThroughLayout, ","  patternLayout: patternLayout, ","  colouredLayout: colouredLayout, ","  coloredLayout: colouredLayout, ","  layout: function(name, config) {","    return layoutMakers[name] &amp;&amp; layoutMakers[name](config);","  }","};"];
