Add 'level' and 'origin' log features
This commit is contained in:
parent
571d600b09
commit
ed1c1d3b1a
2 changed files with 31 additions and 24 deletions
|
@ -309,6 +309,8 @@ public final class EngineConfiguration extends Configuration {
|
|||
* <li><code>moduleVersion</code> (requires <code>moduleName</code>)</li>
|
||||
* <li><code>methodName</code></li>
|
||||
* <li><code>lineNumber</code></li>
|
||||
* <li><code>level</code></li>
|
||||
* <li><code>origin</code></li>
|
||||
* </ul>
|
||||
*
|
||||
* @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;
|
||||
|
||||
|
|
|
@ -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("] ");
|
||||
}
|
||||
|
||||
if (isFeatureEnabled("level") || isFeatureEnabled("origin")) {
|
||||
output.append("[");
|
||||
level(output, level);
|
||||
format(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,6 +249,7 @@ public final class Processor {
|
|||
* @since v1-alpha8
|
||||
*/
|
||||
private static void level(@NotNull StringBuilder builder, @NotNull LogLevel level) {
|
||||
if (isFeatureEnabled("level")) {
|
||||
format(builder, "bold");
|
||||
|
||||
builder.append(switch (level) {
|
||||
|
@ -258,6 +264,7 @@ public final class Processor {
|
|||
|
||||
format(builder, level);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the {@code issuer class} component.
|
||||
|
@ -275,8 +282,6 @@ public final class Processor {
|
|||
builder.append(classNameSplit[classNameSplit.length - 1]);
|
||||
} else
|
||||
builder.append(issuer.getClassName());
|
||||
|
||||
format(builder, level);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue