customLevels brake logging with transports
Sveeborg opened this issue · 1 comments
Sveeborg commented
Hello!
pino 8.11.0
When customLevels is defined and transport level is equal to custom level, logging does not work, but no exceptions occur.
This works fine:
const transport = pino.transport({
targets: [
{
level: 'info',
target: 'pino-pretty',
options: {
translateTime: "yyyy-mm-dd'T'HH:MM:ss'Z'",
ignore: 'pid,hostname',
customLevels: 'serious:35',
customColors: 'serious:green',
useOnlyCustomProps: false,
},
},
],
})
const LOG = pino(
{
level: 'trace',
customLevels: {
serious: 35,
},
},
transport
)
This does not work:
const transport = pino.transport({
targets: [
{
level: 'serious',
target: 'pino-pretty',
options: {
translateTime: "yyyy-mm-dd'T'HH:MM:ss'Z'",
ignore: 'pid,hostname',
customLevels: 'serious:35',
customColors: 'serious:green',
useOnlyCustomProps: false,
},
},
],
})
const LOG = pino(
{
level: 'trace',
customLevels: {
serious: 35,
},
},
transport
)
Problem is not in pino-pretti. Another transports behave similarly.
If I add cusom level into pino levels.js, all works fine:
// pino/lib/levels.js
// ...
const levels = {
trace: 10,
debug: 20,
info: 30,
serious: 35,
warn: 40,
error: 50,
fatal: 60
}
// ...
Sveeborg commented
Sorry! Its issue for pino, not pino-pretty.