-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule.js
More file actions
32 lines (29 loc) · 757 Bytes
/
module.js
File metadata and controls
32 lines (29 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// DUMMY DATA
const User = {
first_name: 'John',
last_name: 'Doe',
age: 25,
online: true,
log(msg) {
console.log(msg);
writeFile;
}
};
// GET USER DETAILS ON LOGIN
const getUserDetailsOnLogin = `
********** USER DETECTED **********\n\n
User: ${User.first_name} ${User.last_name},\nOnline Status: ${User.online}\n
`;
// WRITE USER DETAILS TO FILE
const fs = require('fs');
const path = require('path');
var dir_path = path.join(__dirname, 'output');
var file_path = path.join(dir_path + '.log');
const writeFile = fs.appendFile(file_path,
getUserDetailsOnLogin,
err => {
if (err) console.error(`${err.name}\t${err.message}`);
});
module.exports = {
User, getUserDetailsOnLogin, writeFile
};