From 499d7046951106548dfed102c2047a75828ffdd9 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Thu, 5 Dec 2024 15:37:37 +0100 Subject: [PATCH] Add tag to logging system --- .../base/logging/backend/Processor.java | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/base/src/main/java/de/staropensource/engine/base/logging/backend/Processor.java b/base/src/main/java/de/staropensource/engine/base/logging/backend/Processor.java index ee3343d..58cd2cf 100644 --- a/base/src/main/java/de/staropensource/engine/base/logging/backend/Processor.java +++ b/base/src/main/java/de/staropensource/engine/base/logging/backend/Processor.java @@ -132,7 +132,7 @@ public final class Processor { } output.append("] "); } - message(output, message); + message(output, level, message); format(output, "reset"); // Print @@ -346,23 +346,32 @@ public final class Processor { * Adds the {@code message} component. * * @param builder {@link StringBuilder} instance to append to + * @param level level of the log call * @param message message * @since v1-alpha8 */ - private static void message(@NotNull StringBuilder builder, @NotNull String message) { + private static void message(@NotNull StringBuilder builder, @NotNull LogLevel level, @NotNull String message) { String finalizedMessage = handlePlaceholders( - message.replace( - "\n", - "\n" + " ".repeat( - new EmptyShortcodeParser(builder.toString(), true) - .getClean() - .length() - ) + message + .replace( + "\n", + "\n" + " ".repeat( + new EmptyShortcodeParser(builder.toString(), true) + .getClean() + .length() + ) ) ); if (Logger.isSanitizeMessages()) finalizedMessage = sanitizeFormat(finalizedMessage); + else { + StringBuilder reset_correct = new StringBuilder(); + format(reset_correct, level); + + finalizedMessage = finalizedMessage + .replace("", reset_correct); + } builder.append(finalizedMessage); }