add date to logs

This commit is contained in:
Romain Beaumont 2015-09-06 02:21:28 +02:00
parent 9d1a3e3554
commit eb9ef00596
2 changed files with 13 additions and 10 deletions

View file

@ -2,6 +2,7 @@ var fs = require('fs');
var timeStarted = Math.floor(new Date() / 1000).toString();
var path = require('path');
var mkdirp = require('mkdirp');
var moment=require("moment");
module.exports=inject;
@ -18,6 +19,7 @@ function inject(serv,settings)
var logFile=path.join("logs",timeStarted + ".log");
function log(message) {
message=moment().format('MMMM Do YYYY, hh:mm:ss')+" "+message;
console.log(message);
if (!settings.logging) return;
fs.appendFile(logFile, message + "\n",function(err){

View file

@ -22,18 +22,19 @@
"type": "MIT"
},
"dependencies": {
"minecraft-protocol": "^0.14.0",
"buffers": "0.1.1",
"mocha": "~2.2.5",
"chai": "~3.2.0",
"prismarine-chunk": "git://github.com/rom1504/prismarine-chunk.git#use-prismarine-block",
"prismarine-world": "git://github.com/rom1504/prismarine-world.git#implementation",
"vec3": "0.1.3",
"requireindex": "~1.0.0",
"prismarine-block": "0.1.0",
"minecraft-data": "0.7.0",
"mkdirp":"0.5.1",
"prismarine-entity": "0.1.0"
"minecraft-protocol": "^0.14.0",
"mkdirp": "0.5.1",
"mocha": "~2.2.5",
"moment": "^2.10.6",
"prismarine-block": "0.1.0",
"prismarine-chunk": "git://github.com/rom1504/prismarine-chunk.git#use-prismarine-block",
"prismarine-entity": "0.1.0",
"prismarine-world": "git://github.com/rom1504/prismarine-world.git#implementation",
"requireindex": "~1.0.0",
"vec3": "0.1.3"
},
"repository": {
"type": "git",
@ -45,6 +46,6 @@
"devDependencies": {
"doctoc": "^0.15.0",
"longjohn": "~0.2.8",
"babel":"5.8.23"
"babel": "5.8.23"
}
}