Debugger

A helper class for debugging

Verzia zo dňa 08.10.2017. Pozri najnovšiu verziu.

Tento skript by nemal byť nainštalovaný priamo. Je to knižnica pre ďalšie skripty, ktorú by mali používať cez meta príkaz // @require https://update.greatest.deepsurf.us/scripts/33864/222487/Debugger.js

function Debugger(name, enabled) {
    this.debug = {}
    if (!window.console) {
        return function () {
        }
    }
    for (let m in console) {
        if (typeof console[m] === 'function') {
            if (enabled) {
                this.debug[m] = console[m].bind(window.console + ': ' + name + ': ')
            } else {
                this.debug[m] = function () {
                }
            }
        }
    }
    return this.debug
}