Rename message -> format for LoggerImpl

This commit is contained in:
JeremyStar™ 2024-07-11 05:28:34 +02:00
parent fc24ebef39
commit e376e36eb3
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
4 changed files with 22 additions and 22 deletions

View file

@ -46,20 +46,20 @@ public interface LoggerImpl {
*
* @param level log level
* @param logIssuer log issuer
* @param message log message
* @return new log message
* @param format log format
* @return new log format
* @since 1-alpha0
*/
@NotNull
String postPlaceholder(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String message);
String postPlaceholder(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String format);
/**
* Responsible for printing the finalized log message.
*
* @param level log level
* @param logIssuer log issuer
* @param message finalized log message
* @param format finalized log format
* @since 1-alpha0
*/
void print(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String message);
void print(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String format);
}

View file

@ -56,17 +56,17 @@ public class ColoredLoggerImpl implements LoggerImpl {
/** {@inheritDoc} */
@NotNull
@Override
public String postPlaceholder(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String message) {
public String postPlaceholder(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String format) {
// No modifications necessary
return message;
return format;
}
/** {@inheritDoc} */
@SuppressWarnings({ "resource" }) // Using try-with-resources will cause issues here
@Override
public void print(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String message) {
public void print(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String format) {
// Convert to Ansi
Ansi output = new AnsiShortcodeConverter(message).getAnsi();
Ansi output = new AnsiShortcodeConverter(format).getAnsi();
// Print message
if (level == LogLevel.ERROR || level == LogLevel.CRASH)

View file

@ -54,21 +54,21 @@ public class PlainLoggerImpl implements LoggerImpl {
/** {@inheritDoc} */
@NotNull
@Override
public String postPlaceholder(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String message) {
public String postPlaceholder(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String format) {
// No modifications necessary
return message;
return format;
}
/** {@inheritDoc} */
@Override
public void print(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String message) {
message = new EmptyShortcodeConverter(message).getClean();
public void print(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String format) {
format = new EmptyShortcodeConverter(format).getClean();
if (level == LogLevel.ERROR || level == LogLevel.CRASH)
if (EngineConfiguration.getInstance().isLoggerForceStandardOutput())
System.out.println(message);
System.out.println(format);
else
System.err.println(message);
System.err.println(format);
else
System.out.println(message);
System.out.println(format);
}
}

View file

@ -54,20 +54,20 @@ public class RawLoggerImpl implements LoggerImpl {
/** {@inheritDoc} */
@NotNull
@Override
public String postPlaceholder(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String message) {
public String postPlaceholder(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String format) {
// No modifications necessary
return message;
return format;
}
/** {@inheritDoc} */
@Override
public void print(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String message) {
public void print(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String format) {
if (level == LogLevel.ERROR || level == LogLevel.CRASH)
if (EngineConfiguration.getInstance().isLoggerForceStandardOutput())
System.out.println(message);
System.out.println(format);
else
System.err.println(message);
System.err.println(format);
else
System.out.println(message);
System.out.println(format);
}
}