Hide warning messages in console window

First off: you can hide all warnings and show only console.log output if you are using Microsoft Edge. In the console, there are a couple of icons representing the different levels of log output you may be using - error, warning, and info. If you just want to hide warnings, you can simply toggle the warning icon to off.

Also, if you are on firefox, you can set the log to only display info, in which case the warnings will also be hidden.

Next, to elaborate on the other answer, and phrase what I said (above in my comment) in the form of an answer:

For chrome, you cannot toggle specific levels off individually (newer versions of Chrome). Instead, you have to set an overall verbosity level for the log. By using the strictest level (i.e. the level that displays the least), you can minimize console messages that are created by portions of code that you did not write. In this case, that is the error level.

If you are just trying to hide warning messages for testing purposes, you can, for the time being, switch over to only logging messages at the error level. In production, this is not good practice, as it doesn't let you differentiate between helpful info log messages or actual errors.

To log a message as an error, use:

console.error('mymessage');

Then, as mentioned above, you can change the Level of your console output to error, which will only show you error messages. It will ignore console.log as well as any warning messages.

Be sure to change your calls to console.error back to console.log when you are done with the development phase of your work, for any instances where you are calling console.error with some message that does not describe an error.

Now, if you are getting warnings due to something you are doing in your code, you may want to consider spending time trying to correct whatever is causing those warnings to appear. Warnings are generally well thought out, and are there to help you prevent issues in your code that you may not be aware of. Correcting any issues in your code would also cause the warning messages to go away.

NOTE: you cannot tell the console to only display messages you print out, even at the level of verbosity you set your console to. This is because the console would have no way of knowing which statements you are logging out, versus which statements code your webpage is running that was written by someone else is logging out. The steps mentioned in this answer as well as the other are workarounds that may improve your situation.

UPDATE: It seems like Chrome has reintroduced the ability to enable/disable different levels of console logging individually. Now, when clicking on log level, you can toggle whether certain log levels are enabled or disabled.


Just recently there was a Chrome update. Now filtering single message types is possible (Verbose, Info, Warnings, Errors)! (My Version: Version 60.0.3112.90)

When opening the console, instead of selecting a "filter level", you can now check or uncheck each message type.

Screenshot of Console in Chrome


enter image description here

At the top bar of the console log you can select what kind of messages should be shown.

All is selected by default. Select error to see only error.

You can press ctrl + click to select multiple message types.


As of Chrome version 78 (Dec 2019), in the "Console" tab, click on the "Default levels" pulldown, and uncheck the types of messages you don't want displayed. enter image description here