From 5718f33d88cd57ef2924e882a2055fbff39d745d Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Tue, 20 Aug 2024 22:32:21 +0200 Subject: [PATCH] Fix PlaceholderEngine usage in Logger.java --- .../de/staropensource/sosengine/base/logging/Logger.java | 8 ++++---- .../sosengine/base/utility/PlaceholderEngine.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/base/src/main/java/de/staropensource/sosengine/base/logging/Logger.java b/base/src/main/java/de/staropensource/sosengine/base/logging/Logger.java index a62a0e3c..07e67d1f 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/logging/Logger.java +++ b/base/src/main/java/de/staropensource/sosengine/base/logging/Logger.java @@ -200,10 +200,7 @@ public final class Logger { if (format == null) format = EngineConfiguration.getInstance().getLoggerTemplate(); - // Replace placeholders - // Using PlaceholderEngine - format = PlaceholderEngine.getInstance().process(format); - // Logger placeholders (no colors) + // Replace logger placeholders (no colors) format = new LogClass(issuerClass).replace(format); format = new de.staropensource.sosengine.base.internal.placeholders.logger.LogLevel(level).replace(format); format = new LogMetadata(issuerMetadata).replace(format); @@ -259,6 +256,9 @@ public final class Logger { format = new LogColorPrimary(level).replace(format); format = new LogColorSecondary(level).replace(format); + // Replace placeholders using PlaceholderEngine + format = PlaceholderEngine.getInstance().process(format); + // Invoke LoggerImpl#postPlaceholder format = loggerImplementation.postPlaceholder(level, issuerClass, issuerOrigin, issuerMetadata, message, format); diff --git a/base/src/main/java/de/staropensource/sosengine/base/utility/PlaceholderEngine.java b/base/src/main/java/de/staropensource/sosengine/base/utility/PlaceholderEngine.java index 7afaa111..ce57282d 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/utility/PlaceholderEngine.java +++ b/base/src/main/java/de/staropensource/sosengine/base/utility/PlaceholderEngine.java @@ -142,7 +142,7 @@ public final class PlaceholderEngine { * @return the processed text * @since v1-alpha0 */ - public @NotNull String process(@NotNull String text, List<@NotNull Placeholder> temporaryPlaceholders) { + public @NotNull String process(@NotNull String text, @NotNull List<@NotNull Placeholder> temporaryPlaceholders) { // Process temporary placeholders for (Placeholder temporaryPlaceholder : temporaryPlaceholders) text = temporaryPlaceholder.replace(text);