feat(server): missing rats.log functionality restored #145
This commit is contained in:
parent
70f5a27dab
commit
e306c8d46c
@ -28,12 +28,18 @@ const stringHashCode = (str) => {
|
|||||||
return hash;
|
return hash;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const logFile = fs.createWriteStream('rats.log', {flags : 'w'});
|
||||||
|
|
||||||
global.logT = (type, ...d) => {
|
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));
|
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) => {
|
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');
|
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');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user