From 59564e71e5f70de5ac7978633ed1352a1fb41543 Mon Sep 17 00:00:00 2001 From: Viktor Chernodub <37013688+chernodub@users.noreply.github.com> Date: Tue, 2 Jul 2024 06:06:48 +0000 Subject: [PATCH] fix: allow using non-lowercase custom levels --- logger.js | 2 +- test/test.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/logger.js b/logger.js index 1af36ef..a8d6d8a 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 448a809..fc7b18a 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 )