verifyLogLevel() function

Normalizes an arbitrary value into a LogLevel.

Signature:

export declare function verifyLogLevel(level: unknown): LogLevel;

Parameters

Parameter

Type

Description

level

unknown

the value to validate

Returns:

LogLevel

level unchanged when it is one of log, info, warn or error; otherwise LogLevel.INFO

Remarks

Never throws — null, undefined and unrelated types all resolve to LogLevel.INFO, which makes this the safe way to sanitize an untrusted level string.

Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.