/* automatically generated by JSCoverage - do not edit */
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
if (! _$jscoverage['logging/appenders/fileAppender.js']) {
  _$jscoverage['logging/appenders/fileAppender.js'] = [];
  _$jscoverage['logging/appenders/fileAppender.js'][1] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][48] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][52] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][53] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][54] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][55] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][56] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][57] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][58] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][59] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][60] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][64] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][65] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][66] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][67] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][68] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][69] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][73] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][74] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][75] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][76] = 0;
  _$jscoverage['logging/appenders/fileAppender.js'][77] = 0;
}
_$jscoverage['logging/appenders/fileAppender.js'][1]++;
var define = require("../../define.js").define, base = require("../../base"), promise = require("../../promise"), string = base.string, Promise = promise.Promise, PromiseList = promise.PromiseList, style = string.style, format = string.format, Appender = require("./appender"), Level = require("../level"), fs = require("fs");
_$jscoverage['logging/appenders/fileAppender.js'][48]++;
exports = module.exports = define(Appender, {instance: {constructor: (function (options) {
  _$jscoverage['logging/appenders/fileAppender.js'][52]++;
  options = options || {};
  _$jscoverage['logging/appenders/fileAppender.js'][53]++;
  ! options.name && (options.name = "fileAppender");
  _$jscoverage['logging/appenders/fileAppender.js'][54]++;
  this.__file = options.file || "./log.log";
  _$jscoverage['logging/appenders/fileAppender.js'][55]++;
  this.__encoding = options.encoding || "utf8";
  _$jscoverage['logging/appenders/fileAppender.js'][56]++;
  this.__overwrite = options.overwrite || false;
  _$jscoverage['logging/appenders/fileAppender.js'][57]++;
  this.__writeStream = options.writeStream || fs.createWriteStream(this.__file, {flags: this.__overwrite? "w": "a", encoding: this.__encoding});
  _$jscoverage['logging/appenders/fileAppender.js'][58]++;
  this["super"](arguments, [options]);
  _$jscoverage['logging/appenders/fileAppender.js'][59]++;
  this.__pattern += "\n";
  _$jscoverage['logging/appenders/fileAppender.js'][60]++;
  process.addListener("exit", base.hitch(this, "__onExit"));
}), __onExit: (function () {
  _$jscoverage['logging/appenders/fileAppender.js'][64]++;
  var ret = new Promise();
  _$jscoverage['logging/appenders/fileAppender.js'][65]++;
  var ws = this.__writeStream;
  _$jscoverage['logging/appenders/fileAppender.js'][66]++;
  this.__writeStream = null;
  _$jscoverage['logging/appenders/fileAppender.js'][67]++;
  ws.on("close", base.hitch(ret, "callback"));
  _$jscoverage['logging/appenders/fileAppender.js'][68]++;
  ws.destroySoon();
  _$jscoverage['logging/appenders/fileAppender.js'][69]++;
  return ret;
}), append: (function (event) {
  _$jscoverage['logging/appenders/fileAppender.js'][73]++;
  var ws = this.__writeStream;
  _$jscoverage['logging/appenders/fileAppender.js'][74]++;
  if (this._canAppend(event) && ws && ws.writable) {
    _$jscoverage['logging/appenders/fileAppender.js'][75]++;
    var message = format(this.__pattern, event);
    _$jscoverage['logging/appenders/fileAppender.js'][76]++;
    var level = event.level;
    _$jscoverage['logging/appenders/fileAppender.js'][77]++;
    ws.write(message);
  }
})}});
_$jscoverage['logging/appenders/fileAppender.js'].source = ["var define = require(\"../../define.js\").define,","\t\tbase = require(\"../../base\"),","\t\tpromise = require(\"../../promise\"),","\t\tstring = base.string,","\t\tPromise = promise.Promise,","\t\tPromiseList = promise.PromiseList,","\t\tstyle = string.style,","\t\tformat = string.format,","\t\tAppender = require(\"./appender\"),","\t\tLevel = require(\"../level\"),","\t\tfs = require(\"fs\");","","/**"," * @class Appends messages to a file."," *"," * &lt;pre class=\"code\"&gt;"," *      var fileAppender = new comb.logging.appenders.FileAppender({"," *                                       file : \"/var/log/myLog.log\""," *                                      });"," * &lt;/pre&gt;"," *"," * @name FileAppender"," * @augments comb.logging.appenders.Appender"," * @memberOf comb.logging.appenders"," *"," * @param {Object} [options] options to assign to this Appender"," * @param {String} [options.name=\"appender\"] the name of this Appender. If you want two of the same type of appender"," *                                           on a logger it must have a different name."," * @param {String} [options.pattern=\"[{[yyyy-MM-ddTHH:mm:ss:SSS (z)]timeStamp}] {[- 5]levelName} {[-20]name} - {message}\"]"," *  &lt;p&gt;Available Options for formatting see {@link comb.string.format} for formatting options&lt;/p&gt;"," *  &lt;ul&gt;"," *      &lt;li&gt;timeStamp - the timestamp of the event being logged&lt;/li&gt;"," *      &lt;li&gt;level - the {@link comb.logging.Level} of the event&lt;/li&gt;"," *      &lt;li&gt;levelName - the name of the level being logged&lt;/li&gt;"," *      &lt;li&gt;name - the name of the logger logging the event&lt;/li&gt;"," *      &lt;li&gt;message - the message being logged&lt;/li&gt;"," * &lt;/ul&gt;"," * @param {comb.logging.Level|String} [options.level=comb.logging.Level.INFO] the logging level of this appender"," *      &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; the level can be different from the logger in the case that you want a particular logger"," *      to only log particular event of a level. For example an appender that only logs errors. BEWARE that if the"," *      appenders level is lower than the logger is will not recieve any messages.&lt;/p&gt;"," *"," * @param {String} [options.file=\"./log.log\"] the file to log events to."," * @param {String} [options.encoding=\"utf8\"] the encoding of the file."," * @param {Boolean} [options.overwrite=false] if true the log file is overwritten otherwise it is appended to."," *"," */","exports = module.exports = define(Appender, {","\t\t\tinstance : {","","\t\t\t\tconstructor : function(options) {","\t\t\t\t\toptions = options || {};","\t\t\t\t\t!options.name &amp;&amp; (options.name = \"fileAppender\");","\t\t\t\t\tthis.__file = options.file || \"./log.log\";","\t\t\t\t\tthis.__encoding = options.encoding || \"utf8\";","\t\t\t\t\tthis.__overwrite = options.overwrite || false;","\t\t\t\t\tthis.__writeStream = options.writeStream || fs.createWriteStream(this.__file, { flags: this.__overwrite ? \"w\" : 'a', encoding: this.__encoding});","\t\t\t\t\tthis.super(arguments, [options]);","\t\t\t\t\tthis.__pattern += \"\\n\";","\t\t\t\t\tprocess.addListener(\"exit\", base.hitch(this, \"__onExit\"));","\t\t\t\t},","","\t\t\t\t__onExit : function() {","\t\t\t\t\tvar ret = new Promise();","\t\t\t\t\tvar ws = this.__writeStream;","\t\t\t\t\tthis.__writeStream = null;","\t\t\t\t\tws.on(\"close\", base.hitch(ret, \"callback\"));","\t\t\t\t\tws.destroySoon();","\t\t\t\t\treturn ret;","\t\t\t\t},","","\t\t\t\tappend : function(event) {","\t\t\t\t\tvar ws = this.__writeStream;","\t\t\t\t\tif (this._canAppend(event) &amp;&amp; ws &amp;&amp; ws.writable) {","\t\t\t\t\t\tvar message = format(this.__pattern, event);","\t\t\t\t\t\tvar level = event.level;","\t\t\t\t\t\tws.write(message);","\t\t\t\t\t}","\t\t\t\t}","\t\t\t}","\t\t});"];
