Skip to content

Commit

Permalink
Add Type Example for custom logger (#1867)
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Collina <hello@matteocollina.com>
  • Loading branch information
mcollina committed Dec 14, 2023
1 parent 6b470c1 commit 0981446
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion test/types/pino.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ pino({
crlf: true,
});

const customLevels = { foo: 99 };
const customLevels = { foo: 99, bar: 42 }

const customLevelLogger = pino({ customLevels });

Expand Down Expand Up @@ -378,3 +378,29 @@ try {
} catch (err) {
log.error({ err })
}

const bLogger = pino({
customLevels: {
log: 5,
},
level: 'log',
transport: {
target: 'pino-pretty',
options: {
colorize: true,
},
},
});

expectType<Logger<'log'>>(pino({
customLevels: {
log: 5,
},
level: 'log',
transport: {
target: 'pino-pretty',
options: {
colorize: true,
},
},
}))

0 comments on commit 0981446

Please sign in to comment.