Merged in chore/create-logger-tests (pull request #2996)

Tests for common/logger

* chore: add tests for createLogger

* chore: add tests for createLogger


Approved-by: Linus Flood
This commit is contained in:
Joakim Jäderberg
2025-10-24 13:28:56 +00:00
parent 3b3e7308cc
commit 108bb2b319
6 changed files with 53 additions and 23 deletions
@@ -0,0 +1,19 @@
import { logLevels } from "./logLevels"
export const minimumLogLevel = (() => {
const configuredMinimumLogLevel = (
(process.env.MINIMUM_LOG_LEVEL ||
process.env.NEXT_PUBLIC_MINIMUM_LOG_LEVEL) ??
"info"
).toLowerCase() as (typeof logLevels)[number]
if (!logLevels.includes(configuredMinimumLogLevel)) {
console.warn(
`Invalid log level configured: ${configuredMinimumLogLevel}, defaulting to 'info'`
)
return "info"
}
return configuredMinimumLogLevel
})()