Code coverage report for monolog\lib\handler\StreamHandler.js

Statements: 88.89% (32 / 36)      Branches: 50% (7 / 14)      Functions: 100% (7 / 7)      Lines: 85.71% (24 / 28)      Ignored: none     

All files » monolog\lib\handler\ » StreamHandler.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61    1   1   1   1   1   1 1   1 3     3 3   3 3     3       1 3 3 1         1     1       2 2         1       1          
// Generated by CoffeeScript 1.6.3
"use strict";
var Abstractprocessinghandler, StreamHandler, fs, stream,
  __hasProp = {}.hasOwnProperty,
  __extends = function(child, parent) { for (var key in parent) { Eif (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
 
stream = require('stream');
 
fs = require('fs');
 
Abstractprocessinghandler = require('./AbstractProcessingHandler');
 
StreamHandler = (function(_super) {
  __extends(StreamHandler, _super);
 
  function StreamHandler(_stream, level, bubble) {
    Iif (level == null) {
      level = 100;
    }
    Eif (bubble == null) {
      bubble = true;
    }
    StreamHandler.__super__.constructor.call(this, level, bubble);
    Iif (_stream instanceof stream.Stream) {
      this.stream = _stream;
    } else {
      this.url = _stream;
    }
  }
 
  StreamHandler.prototype.write = function(record, cb) {
    var _this = this;
    if (this.stream === void 0) {
      Iif (this.url === null) {
        if (cb instanceof Function) {
          return cb(new Error('Missing stream url'));
        }
      } else {
        return fs.writeFile(this.url, record.formatted + "\r\n", {
          flag: "a"
        }, function(err, res) {
          return cb(err, res, record, _this);
        });
      }
    } else {
      return this.stream.write(record.formatted, function(err, res) {
        return cb(err, res, record, _this);
      });
    }
  };
 
  return StreamHandler;
 
})(Abstractprocessinghandler);
 
module.exports = StreamHandler;
 
/*
//@ sourceMappingURL=StreamHandler.map
*/