iLog

Logger.

As of 03/12/2020. See the latest version.

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/417761/876223/iLog.js

// ==UserScript==
// @name         iLog
// @namespace    https://www.ocrosoft.com/
// @version      0.1
// @description  Logger.
// @author       ocrosoft
// ==/UserScript==

// Log
function ILog() {
    this.v = function (value) {
        if (level <= this.LogLevel.Verbose) {
            console.log(value);
        }
    }

    this.i = function (info) {
        if (level <= this.LogLevel.Info) {
            console.info(info);
        }
    }

    this.w = function (warning) {
        if (level <= this.LogLevel.Warning) {
            console.warn(warning);
        }
    }

    this.e = function (error) {
        if (level <= this.LogLevel.Error) {
            console.error(error);
        }
    }

    this.setLogLevel = function (logLevel) {
        level = logLevel;
    }

    this.LogLevel = {
        Verbose: 0,
        Info: 1,
        Warning: 2,
        Error: 3,
    };

    let level = this.LogLevel.Verbose;
}
let iLog = new ILog();