控制台输出控制开关

Posted M.Ling

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了控制台输出控制开关相关的知识,希望对你有一定的参考价值。

  var Debugger = function () { 
    };
    //开关,是否显示输出
    Debugger.switch = true;
    Debugger.log = function (message){
        try{
            if(Debugger.switch){
                console.log(message);
            }                  
        }catch(exception){
            return Error:the function  log is not exist.;
        }
    }
    Debugger.switch = false;//关闭控制台输出

 

以上是关于控制台输出控制开关的主要内容,如果未能解决你的问题,请参考以下文章