From 7cdfa00af548112249c27fb8b16dd5d2b8da9a7c Mon Sep 17 00:00:00 2001 From: Max Nuding Date: Tue, 8 Jul 2025 21:09:07 +0200 Subject: [PATCH] switch DEBUG_LOG to string handling --- src/lib/log.ts | 3 ++- src/lib/truthyString.ts | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/log.ts b/src/lib/log.ts index 42f9be8..2d92d18 100644 --- a/src/lib/log.ts +++ b/src/lib/log.ts @@ -4,6 +4,7 @@ import { isTruthy } from '$lib/truthyString'; const { DEV } = import.meta.env; export const enableVerboseLog = isTruthy(env.VERBOSE); +export const debugLogEnv = isTruthy(DEBUG_LOG); /** * @deprecated Use the new {@link Logger} class instead. @@ -42,7 +43,7 @@ export class Logger { public constructor(private name: string) {} public static isDebugEnabled(): boolean { - return !!DEBUG_LOG || DEV || enableVerboseLog; + return debugLogEnv || DEV || enableVerboseLog; } public verbose(...params: any[]) { if (!enableVerboseLog) { diff --git a/src/lib/truthyString.ts b/src/lib/truthyString.ts index 55e4aab..4b6bc1a 100644 --- a/src/lib/truthyString.ts +++ b/src/lib/truthyString.ts @@ -1,4 +1,7 @@ export function isTruthy(value: string | number | boolean | null | undefined): boolean { + if (value === null || value === undefined) { + return false; + } if (typeof value === 'string') { return value.toLowerCase() === 'true' || !!+value; // here we parse to number first }