[READ-ONLY] Mirror of https://github.com/FoxxMD/logging. A typed, opinionated, batteries-included, Pino-based logging solution for backend TS/JS projects foxxmd.github.io/logging
child-logger logging logging-library nodejs pinojs typescript-library
0

Configure Feed

Select the types of activity you want to include in your feed.

test: Add test for runtime labels

FoxxMD (Mar 11, 2024, 1:45 PM EDT) adb983d5 c74fd47a

+13
+13
tests/index.test.ts
··· 520 520 expect(formatted).includes(' [Parent] '); 521 521 expect(formatted).not.includes(' [Test1] '); 522 522 }); 523 + 524 + it('merges labels when provided to log function in info object', async function () { 525 + const [logger, testStream, rawStream] = testConsoleLogger(); 526 + const formattedBuff = pEvent(testStream, 'data'); 527 + const rawBuff = pEvent(rawStream, 'data'); 528 + 529 + logger.addLabel('Parent'); 530 + logger.debug({labels: ['Runtime']},'log something'); 531 + await sleep(10); 532 + const formatted = (await formattedBuff).toString(); 533 + expect(formatted).includes(' [Parent] '); 534 + expect(formatted).includes(' [Runtime] '); 535 + }); 523 536 }); 524 537 });