// eslint-disable-next-line @typescript-eslint/no-var-requires const { MasterLogger, LogLevel, addLogLevel } = require('../build/cjs'); console.log(LogLevel.debug === LogLevel[0], LogLevel.debug === LogLevel[LogLevel[0]], LogLevel[0]); // LogLevel[LogLevel.access = 6] = 'access'; addLogLevel('access', 6); console.log(LogLevel); const logger = new MasterLogger({ debug: true, customTypes: [ 'access' ], customStreams: [ 'access' ], customTypeMapping: { access: 'access', warn: 'error' }, customColours: { access: 'green', // error: '#FF0000' }, fileRotationFreq: 0.0001, logLevelMapping: { access: 2 }, broadcastLevel: 3, webhook: { url: 'https://discord.com/api/webhooks/1093874668886294548/uDMRD6g1lmq_2EZynsbKytzWoMM-0N4te0m61r_cv1BsSnDKDxG3fvI6sxSoG5t5b_xn' } }); console.log(logger); logger.setLogLevel(LogLevel.access); console.log(logger.logLevel); // process.exit(); logger.info('Test'); const spawn = (child) => { return new Promise((resolve) => { child.once('spawn', resolve); }); }; // eslint-disable-next-line @typescript-eslint/no-var-requires const ChildProcess = require('node:child_process'); const main = async () => { const child = ChildProcess.fork('./test/otherProcess.js'); logger.attach(child); await spawn(child); for (let i = 0; i < 10; i++) { await new Promise((resolve) => setTimeout(resolve, 1000)); logger.info(`Iteration ${i}`); } }; main();