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

remove leftover debug code: console.log() calls #796

Closed
wants to merge 1 commit into from

Conversation

NicolasCARPi
Copy link
Contributor

Hello,

After upgrading to 2.2.1, I realized my console was polluted by what appears to be leftover debug code:

2024-07-18-005125_1106x162_scrot

I commented out the culprit lines. Also removed some whitespace and added a spacing after an if.

My recommendations:

  • use console.err() or console.warn() when you wish to log an error or a warning
  • actually, don't use directly console but have a generic function such as log(level, msg) where you provide a level (debug, notice, warn, err) and the wrapper will only emit a message in the console if the loglevel is below the message level. So in dev you'll have your loglevel to "show me everything", and in prod it will just show the warn and errors. This will allow you to leave the debug lines in your code instead of having to comment them out, which is prone to errors.
  • use a linter that will warn you if console.log() calls are present (https://eslint.org/docs/latest/rules/no-console)
  • same linter can also automatically fix trailing whitespaces, incorrect indent or incorrect spacing for expressions

Best,
~Nicolas

@dkoes
Copy link
Contributor

dkoes commented Jul 18, 2024

This is taken care of in 2.2.1-post1

@dkoes dkoes closed this Jul 18, 2024
@NicolasCARPi NicolasCARPi deleted the nico-log branch July 18, 2024 15:40
@NicolasCARPi
Copy link
Contributor Author

NicolasCARPi commented Aug 4, 2024

This is taken care of in 2.2.1-post1

It seems it is still an issue in 2.3.0?

Nevermind, it was a caching issue in my build system!

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.

2 participants