Home Reference Source

application/util/console.js

import Config from './../config';

const isDebug = window._app_debug;

/**
 * Log message, if debug is on
 * @param  {mixed} anything...
 */
const log = (...strn) => {
    if (!isDebug) {
        return;
    }

    console.log(...strn);
};

/**
 * Info message, if debug is on
 * @param  {mixed} anything...
 */
const info = (...strn) => {
    if (!isDebug) {
        return;
    }

    console.info(...strn);
};

/**
 * Warning message, if debug is on
 * @param  {mixed} anything...
 */
const warning = (...strn) => {
    if (!isDebug) {
        return;
    }

    console.warning(...strn);
};

/**
 * Error message, if debug is on
 * @param  {mixed} anything...
 */
const error = (...strn) => {
    if (!isDebug) {
        return;
    }

    console.error(...strn);
};

export {log, info, warning, error};