Skip to content

Commit

Permalink
feat(server): missing rats.log functionality restored #145
Browse files Browse the repository at this point in the history
  • Loading branch information
DEgITx committed Jul 13, 2021
1 parent 59c1923 commit d5243ff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/background/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,18 @@ const stringHashCode = (str) => {
return hash;
};

const logFile = fs.createWriteStream('rats.log', {flags : 'w'});

global.logT = (type, ...d) => {
const date = (new Date).toLocaleTimeString()
console.log(colors.fg.codes[Math.abs(stringHashCode(type)) % 256] + `[${type}]` + colors.reset + ' ' + util.format(...d));
logFile.write(`[${date}] ` + util.format(...d) + '\n');
}

global.logTE = (type, ...d) => {
const date = (new Date).toLocaleTimeString()
console.log(colors.fg.codes[Math.abs(stringHashCode(type)) % 256] + `[${type}]` + colors.reset + ' ' + colors.fg.codes[9] + util.format(...d) + colors.reset + '\n');
logFile.write(`[${date}] ` + util.format(...d) + '\n');
}


Expand Down

0 comments on commit d5243ff

Please sign in to comment.