mirror of
https://github.com/danbulant/flying-squid
synced 2026-07-06 03:31:10 +00:00
fix logging
This commit is contained in:
parent
8fb1582164
commit
31f7946437
3 changed files with 7 additions and 6 deletions
4
app.js
4
app.js
|
|
@ -9,8 +9,8 @@ var options = {
|
||||||
port: settings.port,
|
port: settings.port,
|
||||||
'online-mode': settings.onlineMode,
|
'online-mode': settings.onlineMode,
|
||||||
gameMode:settings.gameMode,
|
gameMode:settings.gameMode,
|
||||||
logging: settings.logging,
|
commands: commands,
|
||||||
commands: commands
|
logging:settings.logging
|
||||||
};
|
};
|
||||||
|
|
||||||
mcServer.createMCServer(options);
|
mcServer.createMCServer(options);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,6 @@
|
||||||
"port": 25565,
|
"port": 25565,
|
||||||
"maxPlayers": 10,
|
"maxPlayers": 10,
|
||||||
"onlineMode": true,
|
"onlineMode": true,
|
||||||
"logging": false,
|
"logging": true,
|
||||||
"gameMode": 0
|
"gameMode": 0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var timeStarted = Math.floor(new Date() / 1000).toString();
|
var timeStarted = Math.floor(new Date() / 1000).toString();
|
||||||
|
var path = require('path');
|
||||||
|
|
||||||
module.exports=inject;
|
module.exports=inject;
|
||||||
|
|
||||||
|
|
@ -19,13 +19,14 @@ function inject(serv,settings)
|
||||||
|
|
||||||
function log(message) {
|
function log(message) {
|
||||||
if (settings.logging == true) {
|
if (settings.logging == true) {
|
||||||
fs.appendFile("logs/" + timeStarted + ".log", message + "\n", function (err) {
|
fs.appendFile(path.join(__dirname,'..','..',"logs",timeStarted + ".log") , message + "\n", function (err) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createLog() {
|
function createLog() {
|
||||||
fs.writeFile("logs/" + timeStarted + ".log", "[INFO]: Started logging...\n", function (err, data) {
|
fs.writeFile(path.join(__dirname,'..','..',"logs",timeStarted + ".log"), "[INFO]: Started logging...\n",
|
||||||
|
function (err, data) {
|
||||||
if (err) return console.log(err);
|
if (err) return console.log(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue