Add <reset_correct> tag to logging system

This commit is contained in:
JeremyStar™ 2024-12-05 15:37:37 +01:00
parent 0c26660f27
commit 499d704695
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -132,7 +132,7 @@ public final class Processor {
} }
output.append("] "); output.append("] ");
} }
message(output, message); message(output, level, message);
format(output, "reset"); format(output, "reset");
// Print // Print
@ -346,23 +346,32 @@ public final class Processor {
* Adds the {@code message} component. * Adds the {@code message} component.
* *
* @param builder {@link StringBuilder} instance to append to * @param builder {@link StringBuilder} instance to append to
* @param level level of the log call
* @param message message * @param message message
* @since v1-alpha8 * @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( String finalizedMessage = handlePlaceholders(
message.replace( message
"\n", .replace(
"\n" + " ".repeat( "\n",
new EmptyShortcodeParser(builder.toString(), true) "\n" + " ".repeat(
.getClean() new EmptyShortcodeParser(builder.toString(), true)
.length() .getClean()
) .length()
)
) )
); );
if (Logger.isSanitizeMessages()) if (Logger.isSanitizeMessages())
finalizedMessage = sanitizeFormat(finalizedMessage); finalizedMessage = sanitizeFormat(finalizedMessage);
else {
StringBuilder reset_correct = new StringBuilder();
format(reset_correct, level);
finalizedMessage = finalizedMessage
.replace("<reset_correct>", reset_correct);
}
builder.append(finalizedMessage); builder.append(finalizedMessage);
} }