Changeset View
Changeset View
Standalone View
Standalone View
support/aphlict/server/lib/AphlictLog.js
| Show All 26 Lines | addLogfile: function(path) { | ||||
| return this; | return this; | ||||
| }, | }, | ||||
| addConsole: function(console) { | addConsole: function(console) { | ||||
| this._writeToConsoles.push(console); | this._writeToConsoles.push(console); | ||||
| return this; | return this; | ||||
| }, | }, | ||||
| log: function(pattern) { | log: function() { | ||||
| var str = util.format.apply(null, arguments); | var str = util.format.apply(null, arguments); | ||||
| var date = new Date().toLocaleString(); | var date = new Date().toLocaleString(); | ||||
| str = '[' + date + '] ' + str; | str = '[' + date + '] ' + str; | ||||
| var ii; | var ii; | ||||
| for (ii = 0; ii < this._writeToConsoles.length; ii++) { | for (ii = 0; ii < this._writeToConsoles.length; ii++) { | ||||
| this._writeToConsoles[ii].log(str); | this._writeToConsoles[ii].log(str); | ||||
| } | } | ||||
| for (ii = 0; ii < this._writeToLogs.length; ii++) { | for (ii = 0; ii < this._writeToLogs.length; ii++) { | ||||
| this._writeToLogs[ii].write(str + "\n"); | this._writeToLogs[ii].write(str + '\n'); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| }); | }); | ||||