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

Browser console messages should respect clientLogLevel #921

Merged
merged 3 commits into from Jul 10, 2017
Merged

Browser console messages should respect clientLogLevel #921

merged 3 commits into from Jul 10, 2017

Conversation

jameslai
Copy link
Contributor

Removes console calls with internal log function which respects clientLogLevel configuration values.

Moves warnings and errors to the warning and error logs, respectively. Also utilizes constants for fewer string comparisons.

Resolves issue #855

@jsf-clabot
Copy link

jsf-clabot commented May 26, 2017

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented May 26, 2017

Codecov Report

Merging #921 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #921   +/-   ##
=======================================
  Coverage   72.13%   72.13%           
=======================================
  Files           4        4           
  Lines         463      463           
  Branches      139      139           
=======================================
  Hits          334      334           
  Misses        129      129

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2041b11...6281af7. Read the comment docs.

Copy link
Contributor

@shellscape shellscape left a comment

Choose a reason for hiding this comment

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

kudos for the PR and the effort. I'd like to see making using of https://www.npmjs.com/package/loglevel and removing the current log function, however. Is that something you'd be up for doing?

@jameslai
Copy link
Contributor Author

Absolutely, I can implement that shortly.

@jameslai
Copy link
Contributor Author

I've rebased the change into a single commit to keep the history clean.

Some defaults we were previously setting were able to be removed in lieu of loglevel's native default methods. Additionally a none setting will now utilize loglevel's disableAll.

We we need to do a little funny business when receiving the log level from configuration, as Webpack's documentation specifies using the string warning while loglevel expects warn.

An error will now be emitted if the configuration is attempting to set an unknown value for clientLogLevel.

Copy link
Contributor

@shellscape shellscape left a comment

Choose a reason for hiding this comment

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

Almost there, just one thing to clear up (see code comment). Please do sign the CLA (#921 (comment)) so we can get this one merged.

var INFO = "info";
var WARNING = "warning";
var ERROR = "error";
var NONE = "none";
Copy link
Contributor

Choose a reason for hiding this comment

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

this is duplicating the same functionality as the quiet option though, isn't it? https://webpack.js.org/configuration/dev-server/#devserver-quiet-

Copy link
Contributor Author

@jameslai jameslai Jun 15, 2017

Choose a reason for hiding this comment

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

The specific lines you highlighted are not duplicating the quiet functionality, but absolutely our consumption of a log level of none (see https://webpack.js.org/configuration/dev-server/#devserver-clientloglevel for the documentation specifying the use of none) most certainly seems like duplicate functionality. I think this is a good question for the Webpack team, being that we technically have two options which will do roughly the same thing - should one of these options be deprecated?

A proposed solution is to deprecate the use of none as an option for clientLogLevel since that is technically not a log level (which the name clientLogLevel suggests), and leaving quiet flagged as true for completely silencing output.

The other option is to deprecate the use of quiet entirely and keep all logging options within the single configuration value of clientLogLevel.

@shellscape shellscape merged commit bd22dce into webpack:master Jul 10, 2017
@lbogdan lbogdan mentioned this pull request Jul 10, 2017
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.

None yet

3 participants