[logger] Add prefixes to most Log messages (#3923)

Co-authored-by: veeck <gitkraken@veeck.de>
This commit is contained in:
Veeck
2025-10-21 20:32:48 +02:00
committed by GitHub
parent f1c0c38c86
commit a1c1e9560c
34 changed files with 220 additions and 238 deletions

View File

@@ -20,7 +20,7 @@ const Translator = (function () {
fileInfo = JSON.parse(xhr.responseText);
} catch (exception) {
// nothing here, but don't die
Log.error(` loading json file =${file} failed`);
Log.error(`[translator] loading json file =${file} failed`);
}
resolve(fileInfo);
}
@@ -67,22 +67,18 @@ const Translator = (function () {
}
if (this.translations[module.name] && key in this.translations[module.name]) {
// Log.log("Got translation for " + key + " from module translation: ");
return createStringFromTemplate(this.translations[module.name][key], variables);
}
if (key in this.coreTranslations) {
// Log.log("Got translation for " + key + " from core translation.");
return createStringFromTemplate(this.coreTranslations[key], variables);
}
if (this.translationsFallback[module.name] && key in this.translationsFallback[module.name]) {
// Log.log("Got translation for " + key + " from module translation fallback.");
return createStringFromTemplate(this.translationsFallback[module.name][key], variables);
}
if (key in this.coreTranslationsFallback) {
// Log.log("Got translation for " + key + " from core translation fallback.");
return createStringFromTemplate(this.coreTranslationsFallback[key], variables);
}
@@ -96,7 +92,7 @@ const Translator = (function () {
* @param {boolean} isFallback Flag to indicate fallback translations.
*/
async load (module, file, isFallback) {
Log.log(`${module.name} - Load translation${isFallback ? " fallback" : ""}: ${file}`);
Log.log(`[translator] ${module.name} - Load translation${isFallback ? " fallback" : ""}: ${file}`);
if (this.translationsFallback[module.name]) {
return;
@@ -113,10 +109,10 @@ const Translator = (function () {
*/
async loadCoreTranslations (lang) {
if (lang in translations) {
Log.log(`Loading core translation file: ${translations[lang]}`);
Log.log(`[translator] Loading core translation file: ${translations[lang]}`);
this.coreTranslations = await loadJSON(translations[lang]);
} else {
Log.log("Configured language not found in core translations.");
Log.log("[translator] Configured language not found in core translations.");
}
await this.loadCoreTranslationsFallback();
@@ -129,7 +125,7 @@ const Translator = (function () {
async loadCoreTranslationsFallback () {
let first = Object.keys(translations)[0];
if (first) {
Log.log(`Loading core translation fallback file: ${translations[first]}`);
Log.log(`[translator] Loading core translation fallback file: ${translations[first]}`);
this.coreTranslationsFallback = await loadJSON(translations[first]);
}
}