From be80698d4e24b9e4ffc8896a0a7d06e7dc696edc Mon Sep 17 00:00:00 2001 From: 3urobeat <35304405+HerrEurobeat@users.noreply.github.com> Date: Sat, 6 May 2023 13:16:11 +0200 Subject: [PATCH] Fix stdout pollution with newlines --- src/controller/controller.js | 5 +++-- src/controller/events/ready.js | 4 ++-- src/starter.js | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/controller/controller.js b/src/controller/controller.js index d7b63b5a..2ba7fb33 100644 --- a/src/controller/controller.js +++ b/src/controller/controller.js @@ -4,7 +4,7 @@ * Created Date: 09.07.2021 16:26:00 * Author: 3urobeat * - * Last Modified: 06.05.2023 11:17:05 + * Last Modified: 06.05.2023 13:14:29 * Modified By: 3urobeat * * Copyright (c) 2021 3urobeat @@ -104,7 +104,8 @@ Controller.prototype._start = async function() { /* ------------ Mark new execution in output: ------------ */ - logger("", "\n\nBootup sequence started...", true, true); + logger("", "", true, true); // Log one newline separated so it only shows up in output.txt + logger("", "\nBootup sequence started...", true, true); // ...add the second newline here so it also shows up in stdout. The message itself gets cleared because remove is true. logger("", "---------------------------------------------------------", true, true); diff --git a/src/controller/events/ready.js b/src/controller/events/ready.js index 00f25fd8..b60f3307 100644 --- a/src/controller/events/ready.js +++ b/src/controller/events/ready.js @@ -4,7 +4,7 @@ * Created Date: 29.03.2023 12:23:29 * Author: 3urobeat * - * Last Modified: 06.05.2023 11:39:51 + * Last Modified: 06.05.2023 12:52:16 * Modified By: 3urobeat * * Copyright (c) 2023 3urobeat @@ -114,7 +114,7 @@ Controller.prototype._readyEvent = function() { // Log amount of warnings displayed by dataCheck and remind the user to take a look - if (this.info.dataCheckWarnings > 0) logger("warn", `The bot started with ${this.info.dataCheckWarnings} warning(s)! Please scroll up and read the warnings displayed during startup!`, true); + if (this.info.dataCheckWarnings > 0) logger("warn", `The bot started with ${this.info.dataCheckWarnings} warning(s)! Please scroll up and read the warnings displayed during startup!\n`, true); // Please star my repo :) diff --git a/src/starter.js b/src/starter.js index 76ddbbcd..34ac980f 100644 --- a/src/starter.js +++ b/src/starter.js @@ -4,7 +4,7 @@ * Created Date: 10.07.2021 10:26:00 * Author: 3urobeat * - * Last Modified: 05.05.2023 16:44:52 + * Last Modified: 06.05.2023 13:10:54 * Modified By: 3urobeat * * Copyright (c) 2021 3urobeat @@ -315,7 +315,8 @@ module.exports.checkAndGetFile = (file, logger, norequire, force) => { } else { try { - if (!file.includes("logger.js")) logger("debug", `checkAndGetFile(): file ${file} exists, force and norequire are false. Testing integrity by requiring...`); // Ignore message for logger.js as it won't use the real logger yet + // Don't log debug msg for logger & handleErrors as they get loaded before the actual logger is loaded. This looks bad in the terminal, is kinda irrelevant and is logged even when logDebug is off + if (!file.includes("logger.js") && !file.includes("handleErrors.js")) logger("debug", `checkAndGetFile(): file ${file} exists, force and norequire are false. Testing integrity by requiring...`); // Ignore message for logger.js as it won't use the real logger yet let fileToLoad = require("." + file);