All files / src/Utils LoggerByDefault.js

100% Statements 7/7
66.66% Branches 4/6
100% Functions 1/1
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29    1x                         185x 185x 185x       185x 185x 185x          
import * as Log from "loglevel";
 
var LoggerByDefault = {
    /**
     * logger statique
     *
     * @static
     * @param {String} name - nom du logger
     * @returns {Object} retourne un logger
     */
    getLogger : function (name) {
        // Substitute global constants configured at compile time
        // cf. webpack.config.js
        // on définit process si non défini dans l'environnement
        // eslint-disable-next-line no-use-before-define
        Eif (typeof process === "undefined") {
            var process = {};
            process.env = {
                VERBOSE : false
            };
        }
        (process.env.VERBOSE) ? Log.enableAll() : Log.disableAll();
        var logname = name || "default";
        return Log.getLogger(logname);
    }
};
 
export default LoggerByDefault;