Added a bug report message to the start of the error log file

This commit is contained in:
Mathias Wagner
2022-10-16 18:16:08 +02:00
parent 5374adc7b3
commit 5aed7f1c27
+3 -3
View File
@@ -4,11 +4,11 @@ const filePath = process.cwd() + "/data/logs/error.log";
// Writes the errors into the error.log file
module.exports = (error) => {
const date = new Date().toLocaleString();
const lineStarter = fs.existsSync(filePath) ? "\n\n" : "";
const lineStarter = fs.existsSync(filePath) ? "\n\n" : "# Found a bug? Report it here: https://github.com/gnmyt/myspeed/issues\n\n";
fs.writeFile(filePath, lineStarter + "## " + date + "\n" + error, {flag: 'a+'}, err => {
if (err) console.error("Could not save error log file.", error);
});
process.exit(1);
process.exit(1);
});
}