debug

用于调试的脚本库

2017-11-11 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greatest.deepsurf.us/scripts/34143/229636/debug.js

// ==UserScript==
// @name         debug
// @namespace    https://github.com/yeomanye
// @version      0.4
// @include      *://*
// @description  用于调试的脚本库
// @author       Ming Ye
// ==/UserScript==

// 开启调试
var consoleFactory = function(prefix, type,suffix,debugMode) {
    prefix = prefix || "";
    type = type || "log";
    suffix = suffix || "";
    return function(msg){
        if (debugMode) {
            var arguments = Array.prototype.slice.apply(arguments);
            arguments.unshift(prefix);
            arguments.push(suffix);
            console[type].apply(null,arguments)
            // console[type](prefix, msg,suffix);
        }
    };
};