WME PLN Module - Logger

Módulo de logging para WME Place Normalizer. No funciona por sí solo.

Version vom 08.09.2025. Aktuellste Version

Dieses Skript sollte nicht direkt installiert werden. Es handelt sich hier um eine Bibliothek für andere Skripte, welche über folgenden Befehl in den Metadaten eines Skriptes eingebunden wird // @require https://update.greatest.deepsurf.us/scripts/548863/1657344/WME%20PLN%20Module%20-%20Logger.js

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         WME PLN Module - Logger
// @namespace    https://greatest.deepsurf.us/en/users/mincho77
// @version      9.0.0
// @description  Módulo de logging para WME Place Normalizer. No funciona por sí solo.
// @author       mincho77
// @license      MIT
// @grant        none
// ==/UserScript==
// Este objeto global controlará todos los logs del script.
window.PLN_LOG_CONFIG = {
    global_enabled: true, // Interruptor principal para todos los logs.
    contexts: {
        'init': true,       // Logs de inicialización del script.
        'scan': false,      // Logs detallados durante el escaneo de lugares.
        'normalize': false, // Trazas del proceso de normalización de nombres.
        'swap': false,      // Logs específicos del motor de "swap".
        'ui': true,         // Logs de creación y eventos de la interfaz.
        'city': false,      // Logs del proceso de "Aplicar Ciudad".
        'sdk': false,       // Logs de interacción con el WME SDK.
        'error': true       // Siempre mostrar errores.
    }
};

// Función de logging que respeta la configuración global y por contexto.
function plnLog(context, ...args) 
{
    // No hacer nada si el log global está deshabilitado y no es un error.
    if (!PLN_LOG_CONFIG.global_enabled && context !== 'error') 
    {
        return;
    }

    // Verificar si el contexto específico está habilitado.
    if (PLN_LOG_CONFIG.contexts[context] === true) 
    {
        const logFunction = context === 'error' ? console.error : console.log;
        logFunction(`[WME PLN][${context}]`, ...args);
    }
}//plnLog