Skip to content

Commit

Permalink
Modified log.js
Browse files Browse the repository at this point in the history
  • Loading branch information
MertJSX committed Aug 22, 2024
1 parent 86519e1 commit faaaf9e
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion log.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,30 @@ async function logAction(username, text, description, config) {
}
}

module.exports = {logAction}
function logFileWriting(filePath, updateTimerFunc, account, config) {
updateTimerFunc(timer => {
if (timer !== null) {
clearTimeout(timer);

timer = setTimeout(() => {
console.log("Stopped writing!");
logAction(account.name, `Stopped Writing File (${path.basename(filePath)}) before 10 seconds`, filePath, config);

updateTimerFunc(() => { return null })
}, 10000);
} else {
console.log("Started writing");

logAction(account.name, `Started Writing File (${path.basename(filePath)})`, filePath, config);

timer = setTimeout(() => {
logAction(account.name, `Write (${path.basename(filePath)})`, filePath, config);
}, 10000);
}

return timer

});
}

module.exports = { logAction, logFileWriting }

0 comments on commit faaaf9e

Please sign in to comment.