From dfd3e937c8693878c3bf458a4f55abdc797cb54b Mon Sep 17 00:00:00 2001 From: Viktor Chernodub <37013688+chernodub@users.noreply.github.com> Date: Wed, 3 Jul 2024 17:28:29 +0300 Subject: [PATCH] fix: allow using non-lowercase custom levels (#342) --- logger.js | 2 +- test/test.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/logger.js b/logger.js index 0e6744d..b2625b1 100644 --- a/logger.js +++ b/logger.js @@ -42,7 +42,7 @@ function pinoLogger (opts, stream) { function getValidLogLevel (level, defaultValue = 'info') { if (level && typeof level === 'string') { - const logLevel = level.trim().toLowerCase() + const logLevel = level.trim() if (validLogLevels.includes(logLevel) === true) { return logLevel } diff --git a/test/test.js b/test/test.js index 2807956..e013f55 100644 --- a/test/test.js +++ b/test/test.js @@ -223,10 +223,10 @@ test('uses the log level passed in as an option, where the level is a custom one const logger = pinoHttp( { customLevels: { - custom: 25 + infoCustom: 25 }, - useLevel: 'custom', - level: 'custom' + useLevel: 'infoCustom', + level: 'infoCustom' }, dest )