|
|
@ -335,17 +335,23 @@ exports.convertToUTF8 = (body) => {
|
|
|
|
return str.toString();
|
|
|
|
return str.toString();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
let logFile = fs.createWriteStream("./data/error.log", {
|
|
|
|
let logFile;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
logFile = fs.createWriteStream("./data/error.log", {
|
|
|
|
flags: "a"
|
|
|
|
flags: "a"
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
} catch (_) { }
|
|
|
|
|
|
|
|
|
|
|
|
exports.errorLog = (error, outputToConsole = true) => {
|
|
|
|
exports.errorLog = (error, outputToConsole = true) => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (logFile) {
|
|
|
|
const dateTime = R.isoDateTime();
|
|
|
|
const dateTime = R.isoDateTime();
|
|
|
|
logFile.write(`[${dateTime}] ` + nodeJsUtil.format(error) + "\n");
|
|
|
|
logFile.write(`[${dateTime}] ` + nodeJsUtil.format(error) + "\n");
|
|
|
|
|
|
|
|
|
|
|
|
if (outputToConsole) {
|
|
|
|
if (outputToConsole) {
|
|
|
|
console.error(error);
|
|
|
|
console.error(error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
} catch (_) { }
|
|
|
|
} catch (_) { }
|
|
|
|
};
|
|
|
|
};
|
|
|
|