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

Option to console.log only important stuff #109

Closed
steida opened this issue Feb 14, 2015 · 14 comments
Closed

Option to console.log only important stuff #109

steida opened this issue Feb 14, 2015 · 14 comments

Comments

@steida
Copy link

steida commented Feb 14, 2015

It is planned or should I send PR?

We don't care about these messages:

[HMR] Waiting for update signal from WDS...
client:14 [WDS] Hot Module Replacement enabled.

There should be an option (default) to log only warnings and errors.

@maxdow
Copy link

maxdow commented Feb 22, 2015

+1

@smussell
Copy link

I agree the following are not useful logs and they are cluttering up my console making it more difficult to sort through and find my own logs.

[WDS] App updated. Recompiling...
[WDS] Nothing changed.

There should be some way for me to disable these logs. This same issue was filed on the react-hot-loader, but it is apparently a webpack issue (gaearon/react-hot-loader#79).

@elektronik2k5
Copy link

+1

@fusepilot
Copy link

Would like this option as well. The logs are a bit verbose after everything is setup correctly.

@luisrudge
Copy link

👍

@FlorentD
Copy link

+1 as well

@dalhundal
Copy link

As a very messy temporary work around, I have a script, development.js which i conditionally append to the entry in webpack.config.js.

"use strict";

// This is a workaround used alongside the webpack-dev-server hot-module-reload feature
//  - it's quite chatty on the console, and there's no currently no configuration option
//    to silence it. Only used in development.
// Prevent messages starting with [HMR] or [WDS] from being printed to the console
(function(global) {
    var console_log = global.console.log
    global.console.log = function() {
        if (!(
            arguments.length == 1 &&
            typeof arguments[0] === 'string' &&
            arguments[0].match(/^\[(HMR|WDS)\]/)
        )) {
            console_log.apply(global.console,arguments)
        }
    }
})(window)

It overloads console.log - skipping any messages starting with [HMR] or [WDS]. It does the job - the fact that it's only used in development eases my discomfort at its horridness :-)

SpaceK33z added a commit that referenced this issue Aug 31, 2016
Previously, when you used `quiet: true` or `noInfo: true` via the Node API or CLI, this only had effect on the output in the terminal (issue #109).

With this PR, these settings will be respected in the browser console as well.

Maybe it would be more flexible to add a separate option for this, but this would also mean more configuration. Looking for feedback on this.
SpaceK33z added a commit that referenced this issue Aug 31, 2016
Previously, when you used `quiet: true` or `noInfo: true` via the Node API or CLI, this only had effect on the output in the terminal (issue #109).

With this PR, these settings will be respected in the browser console as well.

Maybe it would be more flexible to add a separate option for this, but this would also mean more configuration. Looking for feedback on this.
@SpaceK33z
Copy link
Member

SpaceK33z commented Aug 31, 2016

Can you guys check if PR #579 works for you? Looking for feedback!

@SpaceK33z
Copy link
Member

PR #579 was merged, check that out for more info. Note that it hasn't been released yet.

@SpaceK33z
Copy link
Member

Released in 2.1.0-beta.3.

@ghost
Copy link

ghost commented Dec 7, 2016

Thanks for this @SpaceK33z

@felipenmoura
Copy link

Hi
Out of nothing, I started seeing these messages in my terminal every time I update a file:

webpack built c6aa9a16a68277967229 in 3390ms
webpack built 3fdedc302da408daa8dd in 341ms

I narrowed it down to realize it only happens when I have webpackHotMiddleware enabled, even if I have noInfo: true, quiet: true set.

Any idea?

@al6x
Copy link

al6x commented Dec 30, 2017

Same issue, still see the logs with noInfo: true, quiet: true

@pixelomo
Copy link

Thought it was bad form to leave console.log() lines in your production code...

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

No branches or pull requests