forgot a quite important part >.>

This commit is contained in:
Erik 2022-11-08 21:43:51 +02:00
parent 4302fbab57
commit 310b77a4a5
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
3 changed files with 14 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@navy.gif/logger",
"version": "1.1.1",
"version": "1.1.2",
"description": "Logging thing",
"main": "index.js",
"author": "Navy.gif",

View File

@ -38,6 +38,12 @@ class MasterLogger {
return acc;
}, {});
process.on('message', (msg) => {
if (!msg._logger) return;
const { message, type } = msg;
this[type](message);
});
}
write (type = 'info', text, shard = null) {

View File

@ -1,7 +1,13 @@
/* eslint-disable no-console */
const { MasterLogger } = require('../');
const logger = new MasterLogger({ debug: true, customTypes: [ 'access' ], customStreams: [ 'access' ], customTypeMapping: { access: 'access', warn: 'error' }, customColors: { access: 'green' } });
const logger = new MasterLogger({
debug: true,
customTypes: [ 'access' ],
customStreams: [ 'access' ],
customTypeMapping: { access: 'access', warn: 'error' },
customColors: { access: 'green' }
});
const { types, colours, streamTypes, streamTypeMapping } = logger; // , writeStreams
console.log(types, colours, streamTypes, streamTypeMapping); // , writeStreams