Skip to content

feat: add env to disable debug log #1222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vinnymac
Copy link

  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

Adds the ability to completely disable debug logging.

This is a stopgap, if I was requesting an actual fix it would be to implement an inversion of control, and enable the user of this sdk to specify the logger, that way this flag becomes unnecessary. This simple workaround is more than enough for my needs.

Additional context & links

#302

@vinnymac vinnymac requested a review from a team as a code owner December 11, 2024 01:52
typeof process !== 'undefined' &&
typeof process?.env?.['OPENAI_DISABLE_DEBUG'] !== 'string' &&
process?.env?.['DEBUG'] === 'true'
) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we simplify the condition by avoiding redundant optional chaining (?.) on process.env.

if (
  typeof process !== 'undefined' &&
  process?.env && 
  typeof process.env['OPENAI_DISABLE_DEBUG'] !== 'string' &&
  process.env['DEBUG'] === 'true'
) {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could!

However, I won't be making any more changes until I hear from a collaborator on whether or not this PR or a change like it would be merged.

Thanks

@JackNeto
Copy link

Can this be merged please? The solution has already been presented months ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants