var system = require("system"); var fs = require('fs'); var TypeShot = (function() { TypeShot.prototype.page = null; TypeShot.prototype.html = null; TypeShot.prototype.logger = null; TypeShot.prototype.options = { logFile: 'phantom.log', format: 'JPG', width: 960, height: 1280, zoomFactor: 1, timeout: 60000 }; function TypeShot(html, options) { this.html = html; this.options = this.extend(this.options, options); this.setupLogger(); this.setupPhantom(); this.setupPage(); } TypeShot.prototype.setupLogger = function() { var logPath = this.options.logPath; this.logger = { clear: function() { fs.write(logPath, "", 'w'); }, info: function(msg) { fs.write(logPath, msg + "\n", 'a'); }, error: function(msg, trace) { fs.write(logPath, msg + "\n", 'a'); if(trace) { for(var i=0; i