diff --git a/base/src/main/java/de/staropensource/engine/base/EngineConfiguration.java b/base/src/main/java/de/staropensource/engine/base/EngineConfiguration.java index afd1ca6..f367258 100644 --- a/base/src/main/java/de/staropensource/engine/base/EngineConfiguration.java +++ b/base/src/main/java/de/staropensource/engine/base/EngineConfiguration.java @@ -309,6 +309,8 @@ public final class EngineConfiguration extends Configuration { *
  • moduleVersion (requires moduleName)
  • *
  • methodName
  • *
  • lineNumber
  • + *
  • level
  • + *
  • origin
  • * * * @return optional features to enable @@ -490,7 +492,7 @@ public final class EngineConfiguration extends Configuration { optimizeEvents = true; logLevel = LogLevel.INFORMATIONAL; - logFeatures = Set.of("formatting", "time", "methodName", "lineNumber"); + logFeatures = Set.of("formatting", "time", "methodName", "lineNumber", "level", "origin"); logPollingSpeed = 5; logForceStandardOutput = false; 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 fc74e0d..6dd540b 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 @@ -113,20 +113,25 @@ public final class Processor { if (isFeatureEnabled("date") || isFeatureEnabled("time")) { output.append("["); date(output); - if (isFeatureEnabled("date")) + if (isFeatureEnabled("date") && isFeatureEnabled("time")) output.append(" "); time(output); output.append("] "); } - output.append("["); - level(output, level); - format(output, level); - output.append(" "); - issuerClass(output, level, issuer); - issuerModule(output, level, issuer); - methodName(output, level, issuer); - lineNumber(output, level, issuer); - output.append("] "); + + if (isFeatureEnabled("level") || isFeatureEnabled("origin")) { + output.append("["); + level(output, level); + if (isFeatureEnabled("level") && isFeatureEnabled("origin")) + output.append(" "); + if (isFeatureEnabled("origin")) { + issuerClass(output, level, issuer); + issuerModule(output, level, issuer); + methodName(output, level, issuer); + lineNumber(output, level, issuer); + } + output.append("] "); + } message(output, message); format(output, "reset"); @@ -244,19 +249,21 @@ public final class Processor { * @since v1-alpha8 */ private static void level(@NotNull StringBuilder builder, @NotNull LogLevel level) { - format(builder, "bold"); + if (isFeatureEnabled("level")) { + format(builder, "bold"); - builder.append(switch (level) { - case DIAGNOSTIC -> "DIAG"; - case VERBOSE -> "VERB"; - case SILENT_WARNING -> "SARN"; - case INFORMATIONAL -> "INFO"; - case WARNING -> "WARN"; - case ERROR -> "ERR!"; - case CRASH -> "CRSH"; - }); + builder.append(switch (level) { + case DIAGNOSTIC -> "DIAG"; + case VERBOSE -> "VERB"; + case SILENT_WARNING -> "SARN"; + case INFORMATIONAL -> "INFO"; + case WARNING -> "WARN"; + case ERROR -> "ERR!"; + case CRASH -> "CRSH"; + }); - format(builder, level); + format(builder, level); + } } /** @@ -275,8 +282,6 @@ public final class Processor { builder.append(classNameSplit[classNameSplit.length - 1]); } else builder.append(issuer.getClassName()); - - format(builder, level); } /**