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