forked from StarOpenSource/Engine
Rename loggerImplementation in Logger class
This commit is contained in:
parent
c33e3d3e27
commit
889d106470
5 changed files with 22 additions and 22 deletions
|
@ -71,7 +71,7 @@ public final class AnsiSubsystem extends SubsystemClass {
|
|||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void initializeSubsystem() {
|
||||
Logger.setLoggerImplementation(new AnsiLoggingAdapter());
|
||||
Logger.setLoggingAdapter(new AnsiLoggingAdapter());
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
/**
|
||||
* Interface for implementing custom logger implementations.
|
||||
*
|
||||
* @see Logger#setLoggerImplementation(LoggingAdapter)
|
||||
* @see Logger#setLoggingAdapter(LoggingAdapter)
|
||||
* @since v1-alpha0
|
||||
*/
|
||||
public interface LoggingAdapter {
|
||||
|
|
|
@ -133,8 +133,8 @@ Dear developer: FIX YOUR GODDAMN SHIT! Please check if your code or 3rd party su
|
|||
.replace("%content%", processCrashContent())
|
||||
.replace("%handled%", throwableHandled ? "!!! This throwable is declared as handled and has been passed down the execution chain !!!" : "");
|
||||
|
||||
// Invoke LoggerImpl#prePlaceholder
|
||||
String temp = Logger.getLoggerImplementation().prePlaceholder(LogLevel.CRASH, issuerClass, issuerOrigin, issuerMetadata, message, base);
|
||||
// Invoke LoggingAdapter#prePlaceholder
|
||||
String temp = Logger.getLoggingAdapter().prePlaceholder(LogLevel.CRASH, issuerClass, issuerOrigin, issuerMetadata, message, base);
|
||||
if (temp != null)
|
||||
base = temp;
|
||||
|
||||
|
@ -155,12 +155,12 @@ Dear developer: FIX YOUR GODDAMN SHIT! Please check if your code or 3rd party su
|
|||
// Replace placeholders
|
||||
base = PlaceholderEngine.getInstance().process(base, temporaryPlaceholders);
|
||||
|
||||
// Invoke LoggerImpl#postPlaceholder
|
||||
base = Logger.getLoggerImplementation().postPlaceholder(LogLevel.CRASH, issuerClass, issuerOrigin, issuerMetadata, message, base);
|
||||
// Invoke LoggingAdapter#postPlaceholder
|
||||
base = Logger.getLoggingAdapter().postPlaceholder(LogLevel.CRASH, issuerClass, issuerOrigin, issuerMetadata, message, base);
|
||||
|
||||
// Print log message by invoking LoggerImpl#print
|
||||
// Print log message by invoking LoggingAdapter#print
|
||||
Logger.flushLogMessages();
|
||||
Logger.getLoggerImplementation().print(LogLevel.CRASH, issuerClass, issuerOrigin, issuerMetadata, message, base);
|
||||
Logger.getLoggingAdapter().print(LogLevel.CRASH, issuerClass, issuerOrigin, issuerMetadata, message, base);
|
||||
|
||||
// Emit event
|
||||
if (throwableHandled)
|
||||
|
|
|
@ -60,8 +60,8 @@ public final class InitLogger {
|
|||
if (level.compareTo(EngineConfiguration.getInstance().getLoggerLevel()) < 0)
|
||||
return;
|
||||
|
||||
// Invoke LoggerImpl#prePlaceholder
|
||||
String base = Logger.getLoggerImplementation().prePlaceholder(level, issuerClass, issuerOrigin, issuerMetadata, message, template);
|
||||
// Invoke LoggingAdapter#prePlaceholder
|
||||
String base = Logger.getLoggingAdapter().prePlaceholder(level, issuerClass, issuerOrigin, issuerMetadata, message, template);
|
||||
if (base == null)
|
||||
base = template;
|
||||
|
||||
|
@ -71,11 +71,11 @@ public final class InitLogger {
|
|||
base = new LogPath(issuerClass).replace(base);
|
||||
base = base.replace("%log_message%", message.replace("\n", ""));
|
||||
|
||||
// Invoke LoggerImpl#postPlaceholder
|
||||
base = Logger.getLoggerImplementation().postPlaceholder(level, issuerClass, issuerOrigin, issuerMetadata, message, base);
|
||||
// Invoke LoggingAdapter#postPlaceholder
|
||||
base = Logger.getLoggingAdapter().postPlaceholder(level, issuerClass, issuerOrigin, issuerMetadata, message, base);
|
||||
|
||||
// Print log message by invoking LoggerImpl#print
|
||||
Logger.getLoggerImplementation().print(level, issuerClass, issuerOrigin, issuerMetadata, message, base);
|
||||
// Print log message by invoking LoggingAdapter#print
|
||||
Logger.getLoggingAdapter().print(level, issuerClass, issuerOrigin, issuerMetadata, message, base);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -88,13 +88,13 @@ public final class Logger {
|
|||
* -- SETTER --
|
||||
* Sets the active {@link LoggingAdapter}.
|
||||
*
|
||||
* @param loggerImplementation new active {@link LoggingAdapter}
|
||||
* @param loggingAdapter new active {@link LoggingAdapter}
|
||||
* @see LoggingAdapter
|
||||
* @since v1-alpha0
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
private static @NotNull LoggingAdapter loggerImplementation = new PlainLoggingAdapter();
|
||||
private static @NotNull LoggingAdapter loggingAdapter = new PlainLoggingAdapter();
|
||||
|
||||
/**
|
||||
* Contains all active {@link LogRule}s.
|
||||
|
@ -195,8 +195,8 @@ public final class Logger {
|
|||
}
|
||||
}
|
||||
|
||||
// Invoke LoggerImpl#prePlaceholder
|
||||
String format = loggerImplementation.prePlaceholder(level, issuerClass, issuerOrigin, issuerMetadata, message, EngineConfiguration.getInstance().getLoggerTemplate());
|
||||
// Invoke LoggingAdapter#prePlaceholder
|
||||
String format = loggingAdapter.prePlaceholder(level, issuerClass, issuerOrigin, issuerMetadata, message, EngineConfiguration.getInstance().getLoggerTemplate());
|
||||
if (format == null)
|
||||
format = EngineConfiguration.getInstance().getLoggerTemplate();
|
||||
|
||||
|
@ -262,16 +262,16 @@ public final class Logger {
|
|||
// Replace placeholders using PlaceholderEngine again
|
||||
format = PlaceholderEngine.getInstance().process(format);
|
||||
|
||||
// Invoke LoggerImpl#postPlaceholder
|
||||
format = loggerImplementation.postPlaceholder(level, issuerClass, issuerOrigin, issuerMetadata, message, format);
|
||||
// Invoke LoggingAdapter#postPlaceholder
|
||||
format = loggingAdapter.postPlaceholder(level, issuerClass, issuerOrigin, issuerMetadata, message, format);
|
||||
|
||||
// Call event
|
||||
if (!(issuerClass.getName().equals("de.staropensource.sosengine.slf4j_compat.CompatibilityLogger")
|
||||
|| issuerClass.equals(EventHelper.class)))
|
||||
new LogEvent().callEvent(level, issuerClass, issuerOrigin, issuerMetadata, message);
|
||||
|
||||
// Print log message by invoking LoggerImpl#print
|
||||
loggerImplementation.print(level, issuerClass, issuerOrigin, issuerMetadata, message, format);
|
||||
// Print log message by invoking LoggingAdapter#print
|
||||
loggingAdapter.print(level, issuerClass, issuerOrigin, issuerMetadata, message, format);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue