From c0a320b5af9adb6e9c51cd9527d9dcb849e31774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ondr=CC=8Cej=20Langr?= Date: Mon, 7 Oct 2024 12:46:59 +0200 Subject: [PATCH 1/2] fix: Fixes lowercasing the custom levels when useOnlyCustomLevels is true. --- pino.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pino.js b/pino.js index 2398e5acb..9b78a9658 100644 --- a/pino.js +++ b/pino.js @@ -89,7 +89,13 @@ function pino (...args) { const instance = {} const { opts, stream } = normalize(instance, caller(), ...args) - if (opts.level && typeof opts.level === 'string' && DEFAULT_LEVELS[opts.level.toLowerCase()] !== undefined) opts.level = opts.level.toLowerCase() + if ( + opts.level && + typeof opts.level === 'string' && + DEFAULT_LEVELS[opts.level.toLowerCase()] !== undefined &&  + !opts.useOnlyCustomLevels + ) + opts.level = opts.level.toLowerCase() const { redact, From 9be3cc0f4fd7e9502d1dd1233ee869a65dcd5f4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ondr=CC=8Cej=20Langr?= Date: Wed, 23 Oct 2024 21:51:37 +0200 Subject: [PATCH 2/2] Fixes eslint errors --- pino.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pino.js b/pino.js index 9b78a9658..55032a06b 100644 --- a/pino.js +++ b/pino.js @@ -90,12 +90,11 @@ function pino (...args) { const { opts, stream } = normalize(instance, caller(), ...args) if ( - opts.level && - typeof opts.level === 'string' && - DEFAULT_LEVELS[opts.level.toLowerCase()] !== undefined &&  + opts.level && + typeof opts.level === 'string' && + DEFAULT_LEVELS[opts.level.toLowerCase()] !== undefined && !opts.useOnlyCustomLevels - ) - opts.level = opts.level.toLowerCase() + ) { opts.level = opts.level.toLowerCase() } const { redact,