initial
This commit is contained in:
commit
74ae93a96e
1 changed files with 94691 additions and 0 deletions
|
|
@ -0,0 +1,17 @@
|
|||
logging in text file
|
||||
|
||||
in order for console.log to write output in log.txt file
|
||||
|
||||
```js
|
||||
const consoleWrite = (...data) => {
|
||||
const date = new Date();
|
||||
|
||||
// date.toLocaleString()
|
||||
|
||||
fs.appendFileSync(`${__dirname}/log.txt`, `${date.toLocaleString()}\n`);
|
||||
fs.appendFileSync(`${__dirname}/log.txt`, JSON.stringify(data));
|
||||
fs.appendFileSync(`${__dirname}/log.txt`, "\n\n");
|
||||
};
|
||||
|
||||
console.log = consoleWrite;
|
||||
```
|
||||
Loading…
Reference in a new issue