Skip to content

Commit 665b36b

Browse files
author
veeck
committed
Adds prefixes to log messages
1 parent fd3cb99 commit 665b36b

File tree

8 files changed

+25
-32
lines changed

8 files changed

+25
-32
lines changed

js/animateCSS.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function addAnimateCSS (element, animation, animationTime) {
132132
const node = document.getElementById(element);
133133
if (!node) {
134134
// don't execute animate: we don't find div
135-
Log.warn("addAnimateCSS: node not found for", element);
135+
Log.warn("[animateCSS] node not found for adding", element);
136136
return;
137137
}
138138
node.style.setProperty("--animate-duration", `${animationTime}s`);
@@ -149,7 +149,7 @@ function removeAnimateCSS (element, animation) {
149149
const node = document.getElementById(element);
150150
if (!node) {
151151
// don't execute animate: we don't find div
152-
Log.warn("removeAnimateCSS: node not found for", element);
152+
Log.warn("[animateCSS] node not found for removing", element);
153153
return;
154154
}
155155
node.classList.remove("animate__animated", animationName);

js/check_config.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function checkConfigFile () {
4444
}
4545

4646
// Validate syntax of the configuration file.
47-
Log.info(`Checking config file ${configFileName} ...`);
47+
Log.info(`[checkconfig] Checking config file ${configFileName} ...`);
4848

4949
// I'm not sure if all ever is utf-8
5050
const configFile = fs.readFileSync(configFileName, "utf-8");
@@ -67,7 +67,7 @@ function checkConfigFile () {
6767
);
6868

6969
if (errors.length === 0) {
70-
Log.info(styleText("green", "Your configuration file doesn't contain syntax errors :)"));
70+
Log.info(styleText("green", "[checkconfig] Your configuration file doesn't contain syntax errors :)"));
7171
validateModulePositions(configFileName);
7272
} else {
7373
let errorMessage = "Your configuration file contains syntax errors :(";
@@ -84,7 +84,7 @@ function checkConfigFile () {
8484
* @param {string} configFileName - The path and filename of the configuration file to validate.
8585
*/
8686
function validateModulePositions (configFileName) {
87-
Log.info("Checking modules structure configuration ...");
87+
Log.info("[checkconfig] Checking modules structure configuration ...");
8888

8989
const positionList = Utils.getModulePositions();
9090

@@ -118,7 +118,7 @@ function validateModulePositions (configFileName) {
118118

119119
const valid = validate(data);
120120
if (valid) {
121-
Log.info(styleText("green", "Your modules structure configuration doesn't contain errors :)"));
121+
Log.info(styleText("green", "[checkconfig] Your modules structure configuration doesn't contain errors :)"));
122122
} else {
123123
const module = validate.errors[0].instancePath.split("/")[2];
124124
const position = validate.errors[0].instancePath.split("/")[3];
@@ -130,13 +130,13 @@ function validateModulePositions (configFileName) {
130130
} else {
131131
errorMessage += validate.errors[0].message;
132132
}
133-
Log.error(errorMessage);
133+
Log.error("[checkconfig]", errorMessage);
134134
}
135135
}
136136

137137
try {
138138
checkConfigFile();
139139
} catch (error) {
140-
Log.error(error.message);
140+
Log.error("[checkconfig]", error);
141141
process.exit(1);
142142
}

js/electron.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function createWindow () {
4040
try {
4141
electronSize = electron.screen.getPrimaryDisplay().workAreaSize;
4242
} catch {
43-
Log.warn("Could not get display size, using defaults ...");
43+
Log.warn("[electron] Could not get display size, using defaults ...");
4444
}
4545

4646
let electronSwitchesDefaults = ["autoplay-policy", "no-user-gesture-required"];
@@ -196,7 +196,7 @@ app.on("activate", function () {
196196
* core.stop() is called by process.on("SIGINT"... in `app.js`
197197
*/
198198
app.on("before-quit", async (event) => {
199-
Log.log("Shutting down server...");
199+
Log.log("[electron] Shutting down server...");
200200
event.preventDefault();
201201
setTimeout(() => {
202202
process.exit(0);
@@ -215,7 +215,7 @@ app.on("certificate-error", (event, webContents, url, error, certificate, callba
215215

216216
if (process.env.clientonly) {
217217
app.whenReady().then(() => {
218-
Log.log("Launching client viewer application.");
218+
Log.log("[electron] Launching client viewer application.");
219219
createWindow();
220220
});
221221
}
@@ -228,7 +228,7 @@ if (["localhost", "127.0.0.1", "::1", "::ffff:127.0.0.1", undefined].includes(co
228228
core.start().then((c) => {
229229
config = c;
230230
app.whenReady().then(() => {
231-
Log.log("Launching application.");
231+
Log.log("[electron] Launching application.");
232232
createWindow();
233233
});
234234
});

js/main.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ const MM = (function () {
268268
const hideModule = function (module, speed, callback, options = {}) {
269269
// set lockString if set in options.
270270
if (options.lockString) {
271-
// Log.log("Has lockstring: " + options.lockString);
272271
if (module.lockStrings.indexOf(options.lockString) === -1) {
273272
module.lockStrings.push(options.lockString);
274273
}

js/module.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ const Module = Class.extend({
3838
* Called when the module is instantiated.
3939
*/
4040
init () {
41-
//Log.log(this.defaults);
4241
},
4342

4443
/**
@@ -145,9 +144,9 @@ const Module = Class.extend({
145144
*/
146145
notificationReceived (notification, payload, sender) {
147146
if (sender) {
148-
// Log.log(this.name + " received a module notification: " + notification + " from sender: " + sender.name);
147+
Log.debug(`${this.name} received a module notification: ${notification} from sender: ${sender.name}`);
149148
} else {
150-
// Log.log(this.name + " received a system notification: " + notification);
149+
Log.debug(`${this.name} received a system notification: ${notification}`);
151150
}
152151
},
153152

js/node_helper.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ const Class = require("./class");
44

55
const NodeHelper = Class.extend({
66
init () {
7-
Log.log("Initializing new module helper ...");
7+
Log.log("[nodehelper] Initializing new module helper ...");
88
},
99

1010
loaded () {
11-
Log.log(`Module helper loaded: ${this.name}`);
11+
Log.log(`[nodehelper] Module helper loaded: ${this.name}`);
1212
},
1313

1414
start () {
15-
Log.log(`Starting module helper: ${this.name}`);
15+
Log.log(`[nodehelper] Starting module helper: ${this.name}`);
1616
},
1717

1818
/**
@@ -21,7 +21,7 @@ const NodeHelper = Class.extend({
2121
* gracefully exit the module.
2222
*/
2323
stop () {
24-
Log.log(`Stopping module helper: ${this.name}`);
24+
Log.log(`[nodehelper] Stopping module helper: ${this.name}`);
2525
},
2626

2727
/**
@@ -30,7 +30,7 @@ const NodeHelper = Class.extend({
3030
* @param {object} payload The payload of the notification.
3131
*/
3232
socketNotificationReceived (notification, payload) {
33-
Log.log(`${this.name} received a socket notification: ${notification} - Payload: ${payload}`);
33+
Log.log(`[nodehelper] ${this.name} received a socket notification: ${notification} - Payload: ${payload}`);
3434
},
3535

3636
/**
@@ -83,7 +83,7 @@ const NodeHelper = Class.extend({
8383
setSocketIO (io) {
8484
this.io = io;
8585

86-
Log.log(`Connecting socket for: ${this.name}`);
86+
Log.log(`[nodehelper] Connecting socket for: ${this.name}`);
8787

8888
io.of(this.name).on("connection", (socket) => {
8989
// register catch all.

js/translator.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const Translator = (function () {
2020
fileInfo = JSON.parse(xhr.responseText);
2121
} catch (exception) {
2222
// nothing here, but don't die
23-
Log.error(` loading json file =${file} failed`);
23+
Log.error(`[translator] loading json file =${file} failed`);
2424
}
2525
resolve(fileInfo);
2626
}
@@ -67,22 +67,18 @@ const Translator = (function () {
6767
}
6868

6969
if (this.translations[module.name] && key in this.translations[module.name]) {
70-
// Log.log("Got translation for " + key + " from module translation: ");
7170
return createStringFromTemplate(this.translations[module.name][key], variables);
7271
}
7372

7473
if (key in this.coreTranslations) {
75-
// Log.log("Got translation for " + key + " from core translation.");
7674
return createStringFromTemplate(this.coreTranslations[key], variables);
7775
}
7876

7977
if (this.translationsFallback[module.name] && key in this.translationsFallback[module.name]) {
80-
// Log.log("Got translation for " + key + " from module translation fallback.");
8178
return createStringFromTemplate(this.translationsFallback[module.name][key], variables);
8279
}
8380

8481
if (key in this.coreTranslationsFallback) {
85-
// Log.log("Got translation for " + key + " from core translation fallback.");
8682
return createStringFromTemplate(this.coreTranslationsFallback[key], variables);
8783
}
8884

@@ -96,7 +92,7 @@ const Translator = (function () {
9692
* @param {boolean} isFallback Flag to indicate fallback translations.
9793
*/
9894
async load (module, file, isFallback) {
99-
Log.log(`${module.name} - Load translation${isFallback ? " fallback" : ""}: ${file}`);
95+
Log.log(`[translator] ${module.name} - Load translation${isFallback ? " fallback" : ""}: ${file}`);
10096

10197
if (this.translationsFallback[module.name]) {
10298
return;
@@ -113,10 +109,10 @@ const Translator = (function () {
113109
*/
114110
async loadCoreTranslations (lang) {
115111
if (lang in translations) {
116-
Log.log(`Loading core translation file: ${translations[lang]}`);
112+
Log.log(`[translator] Loading core translation file: ${translations[lang]}`);
117113
this.coreTranslations = await loadJSON(translations[lang]);
118114
} else {
119-
Log.log("Configured language not found in core translations.");
115+
Log.log("[translator] Configured language not found in core translations.");
120116
}
121117

122118
await this.loadCoreTranslationsFallback();
@@ -129,7 +125,7 @@ const Translator = (function () {
129125
async loadCoreTranslationsFallback () {
130126
let first = Object.keys(translations)[0];
131127
if (first) {
132-
Log.log(`Loading core translation fallback file: ${translations[first]}`);
128+
Log.log(`[translator] Loading core translation fallback file: ${translations[first]}`);
133129
this.coreTranslationsFallback = await loadJSON(translations[first]);
134130
}
135131
}

modules/default/calendar/calendarfetcherutils.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ const CalendarFetcherUtils = {
287287
} else {
288288
// Single event.
289289
const fullDayEvent = isFacebookBirthday ? true : CalendarFetcherUtils.isFullDayEvent(event);
290-
// Log.debug("full day event")
291290

292291
// if the start and end are the same, then make end the 'end of day' value (start is at 00:00:00)
293292
if (fullDayEvent && eventStartMoment.valueOf() === eventEndMoment.valueOf()) {

0 commit comments

Comments
 (0)