Skip to content

Commit

Permalink
feat: add env to disable debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
vinnymac committed Dec 11, 2024
1 parent 6e8c1d0 commit 6dc004d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 6dc004d

Please sign in to comment.