Added error handling functions when saving to file.

parent 229fe3d0
......@@ -41,7 +41,10 @@ const logger = {
if (this._loggers.indexOf(this.FILE) >= 0) {
let date = new Date();
let dateStr = date.getFullYear() + '.' + (date.getMonth()+1) + '.' + date.getDate() + '.txt';
fs.appendFile(path.join(this._path, dateStr), date + ' : ' + string + '\n');
fs.appendFile(path.join(this._path, dateStr), date + ' : ' + string + '\n', function(error) {
if (error)
console.log('Can not write to log file! Error: ' + error.message);
});
}
},
_mongo : function (string) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment