src/models/util.js
function (message, important) {
            /** @type {string} */
            const prefix = 'VarGate SG1 Log:';
            /** @type {Array} */
            let args = [];
            if (window['DEBUG_MODE']) {
                if (typeof message !== 'string' && message.length) {
                    args = message;
                } else {
                    args.push(message);
                }
                args.unshift(prefix);
                try {
                    switch (window['DEBUG_MODE']) {
                        case 'verbose':
                            console['warn'].apply(console, args);
                            break;
                        case 'static':
                            console['warn'].apply(console, JSON.parse(JSON.stringify(args)));
                            break;
                        case 'minimal':
                            if (important) console['warn'].apply(console, args);
                            break;
                        default:
                        // do nothing
                    }
                } catch (e) {
                    // Looks like we can't log anything
                }
            }
        }
function (message, important) {
            /** @type {string} */
            const prefix = 'VarGate SG1 Log:';
            /** @type {Array} */
            let args = [];
            if (window['DEBUG_MODE']) {
                if (typeof message !== 'string' && message.length) {
                    args = message;
                } else {
                    args.push(message);
                }
                args.unshift(prefix);
                try {
                    switch (window['DEBUG_MODE']) {
                        case 'verbose':
                            console['warn'].apply(console, args);
                            break;
                        case 'static':
                            console['warn'].apply(console, JSON.parse(JSON.stringify(args)));
                            break;
                        case 'minimal':
                            if (important) console['warn'].apply(console, args);
                            break;
                        default:
                        // do nothing
                    }
                } catch (e) {
                    // Looks like we can't log anything
                }
            }
        }
function ( message , important ) { /** @type {string} */ const prefix = 'VarGate SG1 Log:' ; /** @type {Array} */ let args = [ ] ; if ( window [ 'DEBUG_MODE' ] ) { if ( typeof message !== 'string' && message . length ) { args = message ; } else { args . push ( message ) ; } args . unshift ( prefix ) ; try { switch ( window [ 'DEBUG_MODE' ] ) { case 'verbose' : console [ 'warn' ] . apply ( console , args ) ; break ; case 'static' : console [ 'warn' ] . apply ( console , JSON . parse ( JSON . stringify ( args ) ) ) ; break ; case 'minimal' : if ( important ) console [ 'warn' ] . apply ( console , args ) ; break ; default : // do nothing } } catch ( e ) { // Looks like we can't log anything } } }
Conditionally logs messages to help debug based on the value of DEBUG_MODE
@param {Array|string} message
@param {boolean=} important
Conditionally logs messages to help debug based on the value of DEBUG_MODE