Setting to reduce verbosity of logs (don't log item transfers)

This commit is contained in:
Danielv123 committed 2018-01-04 18:50:09 +01:00
1 parent df60455d5e
commit 5dc71ad46e
3 files changed
+18 -8

No files matched your search

+7 -3
View File
@@ -684,7 +684,9 @@ function instanceManagement() {
instanceID: instanceconfig.unique, // a hash computed from the randomly generated rcon password instanceID: instanceconfig.unique, // a hash computed from the randomly generated rcon password
}, function (err, resp, body) { }, function (err, resp, body) {
if(body == "failure") console.error("#### Export failed! Lost: "+g[1]+" "+g[0]); if(body == "failure") console.error("#### Export failed! Lost: "+g[1]+" "+g[0]);
if(body == "success") console.log(`Exported ${g[1]} ${g[0]} to master`) if(config.logItemTransfers){
if(body == "success") console.log(`Exported ${g[1]} ${g[0]} to master`);
}
}); });
} }
} }
@@ -741,9 +743,11 @@ function instanceManagement() {
if (response && response.body && typeof response.body == "object") { if (response && response.body && typeof response.body == "object") {
// buffer confirmed orders // buffer confirmed orders
confirmedOrders[confirmedOrders.length] = { confirmedOrders[confirmedOrders.length] = {
[response.body.name]: response.body.count [response.body.name]: response.body.count;
}
if(config.logItemTransfers){
console.log(`Imported ${response.body.count} ${response.body.name} from master`);
} }
console.log(`Imported ${response.body.count} ${response.body.name} from master`);
} }
}); });
} }
+2 -1
View File
@@ -28,5 +28,6 @@
"itemStats": { "itemStats": {
"maxEntries":60, "maxEntries":60,
"entriesPerSecond": 0.01666666667 "entriesPerSecond": 0.01666666667
} },
"logItemTransfers": false
} }
+9 -4
View File
@@ -270,8 +270,9 @@ app.post("/api/place", function(req, res) {
&& x.instanceName && x.instanceName
&& !isNaN(Number(x.count))// This is in no way a proper authentication or anything, its just to make sure everybody are registered as slaves before modifying the cluster (or not, to maintain backwards compat) && !isNaN(Number(x.count))// This is in no way a proper authentication or anything, its just to make sure everybody are registered as slaves before modifying the cluster (or not, to maintain backwards compat)
/*&& stringUtils.hashCode(slaves[x.unique].rconPassword) == x.unique*/){ /*&& stringUtils.hashCode(slaves[x.unique].rconPassword) == x.unique*/){
if(config.logItemTransfers){
console.log("added: " + req.body.name + " " + req.body.count+" from "+x.instanceName+" ("+x.instanceID+")"); console.log("added: " + req.body.name + " " + req.body.count+" from "+x.instanceName+" ("+x.instanceID+")");
}
// gather statistics // gather statistics
let recievedItemStatistics = recievedItemStatisticsBySlaveID[x.instanceID]; let recievedItemStatistics = recievedItemStatisticsBySlaveID[x.instanceID];
if(recievedItemStatistics === undefined){ if(recievedItemStatistics === undefined){
@@ -326,7 +327,9 @@ app.post("/api/remove", function(req, res) {
let item = db.items[object.name] let item = db.items[object.name]
// console.dir(doc); // console.dir(doc);
if (!item) { if (!item) {
console.log('failure could not find ' + object.name); if(config.logItemTransfers){
console.log('failure could not find ' + object.name);
}
res.send({name:object.name, count:0}); res.send({name:object.name, count:0});
} else { } else {
const originalCount = Number(object.count) || 0; const originalCount = Number(object.count) || 0;
@@ -338,7 +341,9 @@ app.post("/api/remove", function(req, res) {
if(Number(item) > Number(object.count)) { if(Number(item) > Number(object.count)) {
//If successful, increase dole //If successful, increase dole
_doleDivisionFactor[object.name] = Math.max((_doleDivisionFactor[object.name]||0)||1, 1) - 1; _doleDivisionFactor[object.name] = Math.max((_doleDivisionFactor[object.name]||0)||1, 1) - 1;
//console.log("removed: " + object.name + " " + object.count + " . " + item + " and sent to " + object.instanceID + " | " + object.instanceName); if(config.logItemTransfers){
console.log("removed: " + object.name + " " + object.count + " . " + item + " and sent to " + object.instanceID + " | " + object.instanceName);
}
if(db.items.removeItem({count: object.count, name: object.name})){ if(db.items.removeItem({count: object.count, name: object.name})){
let sentItemStatistics = sentItemStatisticsBySlaveID[object.instanceID]; let sentItemStatistics = sentItemStatisticsBySlaveID[object.instanceID];
if(sentItemStatistics === undefined){ if(sentItemStatistics === undefined){