Webpack-dev-server: cannot mute webpack/hot/dev-server console.logs

Created on 14 Mar 2019  路  5Comments  路  Source: webpack/webpack-dev-server

Do you want to request a feature or report a bug?

bug

What is the current behavior?
Right now webpack/hot/dev-server/ spams my console, especially with multiple hot entry points (double spam).

[HMR] Waiting for update signal from WDS...
[HMR] Checking for updates on the server...
[HMR] Updated modules:
[HMR]  - ../ng-cli/node_modules/css-loader/index.js!../ng-cli/node_modules/sass-loader/index.js!./src/assets/styles/main.scss
[HMR] App is up to date.

If the current behavior is a bug, please provide the steps to reproduce.
Use HMR in one of the entry points and check browser console.

What is the expected behavior?
Selective console logs in browser. Values: none, error, warning, info.

Webpack-dev-server has a devServer.clientLogLevel option, implemented here. The problem is, webpack/hot/dev-server should respect this option.

Files doing the spam:

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.

win10/ubuntu 1604, node v7.4.0, npm v4.0.5, webpack-, webpack-dev-server v2.2.0


This issue was moved from webpack/webpack#4115 by @evilebottnawi. Original issue was by @tsm91.

Most helpful comment

Setting clientLogLevel: 'none' muted 99% of console stuff but I still see
Waiting for update signal from WDS

Version 3.3.1

All 5 comments

/cc @noelebrun

Can you clarify clientLogLevel diesn't respect hot? What is spam messages? Maybe you can show what you options/command use and what you actually have and what you expected, thanks?

Hey,

I'm not really able to reproduce the issue, as I was saying in the previous discussion, I think the issue has already been fixed.

Feel free to feedback/open new issue

Setting clientLogLevel: 'none' muted 99% of console stuff but I still see
Waiting for update signal from WDS

Version 3.3.1

Setting clientLogLevel: 'none' muted 99% of console stuff but I still see
Waiting for update signal from WDS

Version 3.3.1

^ Same, and the log info comes from:

module.exports = function(level, msg) {
    if (shouldLog(level)) {
        if (level === "info") {
            console.log(msg);
        } else if (level === "warning") {
            console.warn(msg);
        } else if (level === "error") {
            console.error(msg);
        }
    }
};

where:

function shouldLog(level) {
    var shouldLog =
        (logLevel === "info" && level === "info") ||
        (["info", "warning"].indexOf(logLevel) >= 0 && level === "warning") ||
        (["info", "warning", "error"].indexOf(logLevel) >= 0 && level === "error");
    return shouldLog;
}

^ I don't think silent or none etc. params are passed to these functions while info is always passed, didn't dig into that, just a guess :)

Was this page helpful?
0 / 5 - 0 ratings