{"size": 684, "ext": "js", "max_stars_repo_path": "src/utils/log.js", "max_stars_repo_name": "tonymamo/belay", "max_stars_repo_stars_event_min_datetime": "2019-03-29T14:14:57.000Z", "max_stars_repo_stars_event_max_datetime": "2019-03-29T14:14:57.000Z", "max_issues_repo_path": "src/utils/log.js", "max_issues_repo_name": "tonymamo/belay", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/utils/log.js", "max_forks_repo_name": "tonymamo/belay", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.4285714286, "max_line_length": 81, "alphanum_fraction": 0.6111111111}
let _isActive = false;

export const LOG_LEVELS = {
    ERROR: 1,
    WARNING: 2,
    NORMAL: 4
};

export const configureLogger = (options) => {
    options = options || {};
    _isActive = options.isActive;
};

export const log = (message, logLevel) => {
    if (!_isActive) { return; }
    logLevel = logLevel || LOG_LEVELS.NORMAL;

    switch(logLevel) {
        case LOG_LEVELS.ERROR:
            return console.error ? console.error(message) : console.log(message);
        case LOG_LEVELS.WARNING:
            return console.warn ? console.warn(message) : console.log(message);
        case LOG_LEVELS.NORMAL:
        default:
            return console.log(message);
    }
};
