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:
@@ -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
|
||||
})()
|
||||
Reference in New Issue
Block a user