16 lines
No EOL
487 B
JavaScript
16 lines
No EOL
487 B
JavaScript
const fs = require('fs');
|
|
|
|
function logAction(action, userid, username) {
|
|
const date = new Date();
|
|
const formattedDate = `${date.getDate()}${date.getMonth() + 1}${date.getFullYear()}`;
|
|
const logMessage = `${new Date().toISOString()} ${action}\n`;
|
|
fs.appendFile(`./logs/${userid}_${username}_${formattedDate}.txt`, logMessage, (err) => {
|
|
if (err) {
|
|
console.error(`Failed to log action: ${err}`);
|
|
}
|
|
});
|
|
}
|
|
|
|
module.exports = {
|
|
logAction
|
|
}; |