在控制台日志中隐藏特定的警告

时间:2020-07-14 13:31:05

标签: javascript console.log

检查了stackoverflow中的大多数论坛后,我无法找到合适的解决方案。 我正在尝试从控制台日志中隐藏以下警告:

This page uses the non standard property “zoom”. Consider using calc() in the relevant property values, or using “transform” along with “transform-origin: 0 0”.

我找到了以下脚本,其中包含工程实例警告消息:

(function () {
    var method;
    var noop = function noop() { };
    var methods = [
    'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
    'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
    'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
    'timeStamp', 'trace', 'warn'
    ];
    var length = methods.length;
    var console = (window.console = window.console || {});

    while (length--) {
        method = methods[length];
        console[method] = noop;
    }
}());

感谢您的支持和建议

0 个答案:

没有答案