Skip to content
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

fix: Simplified level assignment logic in BrowserConsole #7329

Closed
wants to merge 1 commit into from

Conversation

brawncode
Copy link

Description

I’ve updated the logic in the BrowserConsole function that handles the level property. Previously, there was a redundant check for opts in the conditional expression. Since we are already checking for the existence of opts?.level, it's unnecessary to verify opts again.

I’ve simplified the assignment to use the nullish coalescing operator (??), which directly assigns the value of opts.level if it exists, or defaults to "info" if it doesn't ;)

@brawncode brawncode requested a review from a team as a code owner December 22, 2024 13:13
@CLAassistant
Copy link

CLAassistant commented Dec 22, 2024

CLA assistant check
All committers have signed the CLA.

@matthewkeil
Copy link
Member

Thanks for you submission @brawncode !!! We love outside contributions and welcome you to attempt another PR. This is unfortunately something we cannot merge. The code does not achieve the goal that you think it will. Please feel free to reach out to us over discord if you have any questions, concerns or would like to take another shot at this! Thanks again!!

@matthewkeil matthewkeil closed this Jan 7, 2025
@wemeetagain
Copy link
Member

Just to clarify, the Object.prototype.hasOwnProperty.call(this.levels, opts.level) is ensuring that the opt.level is one of "error", "warn", "info", "verbose", "debug", "trace" so removing that part removes that validation/coercion.

@brawncode brawncode deleted the patch-1 branch January 8, 2025 19:18
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.

4 participants