SPB Git

spb/admin-ka

Public
1.3 KB · 57 lines javascript
1/*2 * noVNC: HTML5 VNC client3 * Copyright (C) 2019 The noVNC authors4 * Licensed under MPL 2.0 (see LICENSE.txt)5 *6 * See README.md for usage and integration instructions.7 */89/*10 * Logging/debug routines11 */1213let _logLevel = 'warn';1415let Debug = () => {};16let Info = () => {};17let Warn = () => {};18let Error = () => {};1920export function initLogging(level) {21    if (typeof level === 'undefined') {22        level = _logLevel;23    } else {24        _logLevel = level;25    }2627    Debug = Info = Warn = Error = () => {};2829    if (typeof window.console !== "undefined") {30        /* eslint-disable no-console, no-fallthrough */31        switch (level) {32            case 'debug':33                Debug = console.debug.bind(window.console);34            case 'info':35                Info  = console.info.bind(window.console);36            case 'warn':37                Warn  = console.warn.bind(window.console);38            case 'error':39                Error = console.error.bind(window.console);40            case 'none':41                break;42            default:43                throw new window.Error("invalid logging type '" + level + "'");44        }45        /* eslint-enable no-console, no-fallthrough */46    }47}4849export function getLogging() {50    return _logLevel;51}5253export { Debug, Info, Warn, Error };5455// Initialize logging level56initLogging();57
Files · 34a4effcd084d99ed6b5f3dd2af0742e988cc49b
Menu

Theme