fix: Log filename add milliseconds

This commit is contained in:
linyuchen 2024-05-12 17:56:42 +08:00
parent b14135ed72
commit 07852a7295

View File

@ -21,7 +21,8 @@ function getFormattedTimestamp() {
const hours = now.getHours().toString().padStart(2, '0'); const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0'); const minutes = now.getMinutes().toString().padStart(2, '0');
const seconds = now.getSeconds().toString().padStart(2, '0'); const seconds = now.getSeconds().toString().padStart(2, '0');
return `${year}-${month}-${day}_${hours}-${minutes}-${seconds}`; const milliseconds = now.getMilliseconds().toString().padStart(3, '0');
return `${year}-${month}-${day}_${hours}-${minutes}-${seconds}.${milliseconds}`;
} }
const filename = `${getFormattedTimestamp()}.log`; const filename = `${getFormattedTimestamp()}.log`;