Latest.log instead of all being a timestamp

This commit is contained in:
Izuco 2022-03-05 18:58:19 +01:00
parent 115781c92a
commit 2e6710dc34
No known key found for this signature in database
GPG key ID: E9CBE9E4EF3A1BFA
2 changed files with 4 additions and 2 deletions

View file

@ -78,7 +78,7 @@ body:
id: output
attributes:
label: Console Output
description: "Please paste the console output from the beginning till termination here. If you are using the gui open the log folder under 'Debug > Open Log Folder' in the Menu. Please copy the content of the file with the highest number here."
description: "Please paste the console output from the beginning till termination here. If you are using the gui open the log folder under 'Debug > Open Log Folder' in the Menu. Please copy the content of latest.log here."
validations:
required: true
- type: textarea

View file

@ -74,7 +74,9 @@ if (!process.env.TEST) {
const logFolder = path.join(getDataDirectory(), 'logs');
if (!fs.existsSync(logFolder))
fs.mkdirSync(logFolder);
return new Console(fs.createWriteStream(path.join(logFolder, `${Date.now()}.log`)));
if (fs.existsSync(path.join(logFolder, 'latest.log')))
fs.renameSync(path.join(logFolder, 'latest.log'), path.join(logFolder, `${Date.now()}.log`));
return new Console(fs.createWriteStream(path.join(logFolder, `latest.log`)));
})();
}