From 6dc004d37cf634955ecbb536509473940725381f Mon Sep 17 00:00:00 2001 From: Vincent Taverna Date: Tue, 10 Dec 2024 20:45:15 -0500 Subject: [PATCH] feat: add env to disable debug log --- src/core.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core.ts b/src/core.ts index 803496412..dc33ab614 100644 --- a/src/core.ts +++ b/src/core.ts @@ -877,7 +877,7 @@ const getPlatformProperties = (): PlatformProperties => { 'X-Stainless-Arch': normalizeArch(Deno.build.arch), 'X-Stainless-Runtime': 'deno', 'X-Stainless-Runtime-Version': - typeof Deno.version === 'string' ? Deno.version : Deno.version?.deno ?? 'unknown', + typeof Deno.version === 'string' ? Deno.version : (Deno.version?.deno ?? 'unknown'), }; } if (typeof EdgeRuntime !== 'undefined') { @@ -1139,7 +1139,11 @@ function applyHeadersMut(targetHeaders: Headers, newHeaders: Headers): void { } export function debug(action: string, ...args: any[]) { - if (typeof process !== 'undefined' && process?.env?.['DEBUG'] === 'true') { + if ( + typeof process !== 'undefined' && + typeof process?.env?.['OPENAI_DISABLE_DEBUG'] !== 'string' && + process?.env?.['DEBUG'] === 'true' + ) { console.log(`OpenAI:DEBUG:${action}`, ...args); } }