More logging!!!
This commit is contained in:
parent
db31f3f31f
commit
37dfa3d48b
12
index.js
12
index.js
|
@ -195,6 +195,12 @@ const watchFiles = () => {
|
|||
tmp = funcs.makeBansTable(newContents)
|
||||
// Do stuff
|
||||
console.log(`IP Bans changed\nOld Length: ${Object.keys(ipBans).length}\nNew Length: ${Object.keys(tmp).length}`)
|
||||
// if the number of adds or removes is over 40 ignore it
|
||||
if (Object.keys(funcs.diff(ipBans, tmp).added).length > 40 || Object.keys(funcs.diff(ipBans, tmp).removed).length > 40) {
|
||||
console.log("Too many changes, logging and ignoring")
|
||||
fs.writeFileSync(`errors/changes-${Date.now()}.log`, JSON.stringify(funcs.diff(idBans, tmp), null, 2));
|
||||
return;
|
||||
}
|
||||
sendMessages(funcs.diff(ipBans, tmp))
|
||||
ipBans = jsonfix(tmp)
|
||||
ipRaw = String(newContents)
|
||||
|
@ -205,6 +211,12 @@ const watchFiles = () => {
|
|||
// Do stuff
|
||||
console.log(`ID Bans changed\nOld Length: ${Object.keys(idBans).length}\nNew Length: ${Object.keys(tmp).length}`)
|
||||
console.log(JSON.stringify(funcs.diff(idBans, tmp), null, 2))
|
||||
// if the number of adds or removes is over 40 ignore it
|
||||
if (Object.keys(funcs.diff(idBans, tmp).added).length > 40 || Object.keys(funcs.diff(idBans, tmp).removed).length > 40) {
|
||||
console.log("Too many changes, logging and ignoring")
|
||||
fs.writeFileSync(`errors/changes-${Date.now()}.log`, JSON.stringify(funcs.diff(idBans, tmp), null, 2));
|
||||
return;
|
||||
}
|
||||
sendMessages(funcs.diff(idBans, tmp))
|
||||
idBans = jsonfix(tmp)
|
||||
idRaw = String(newContents)
|
||||
|
|
Loading…
Reference in a new issue