Make EngineConfiguration a bit safer

This commit is contained in:
JeremyStar™ 2024-06-11 20:00:23 +02:00
parent 0031c4ef29
commit f9d5a4e124
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
2 changed files with 6 additions and 1 deletions

View file

@ -47,7 +47,7 @@ public final class EngineConfiguration implements SubsystemConfiguration {
* -- GETTER --
* Returns the {@link EngineConfiguration} instance.
*
* @return {@link EngineConfiguration} instance
* @return {@link EngineConfiguration} instance unless {@link Engine} is uninitialized
* @since 1-alpha0
*/
@Getter

View file

@ -19,6 +19,7 @@
package de.staropensource.sosengine.base.logging;
import de.staropensource.sosengine.base.Engine;
import de.staropensource.sosengine.base.EngineConfiguration;
import de.staropensource.sosengine.base.classes.LoggerImpl;
import de.staropensource.sosengine.base.classes.Placeholder;
@ -85,6 +86,10 @@ public final class Logger {
* @since 1-alpha0
*/
private static void log(@NotNull LogLevel level, @NotNull LogIssuer logIssuer, @NotNull String message) {
// Check if engine has initialized
if (Engine.getInstance() == null) return;
// Check if level is allowed
if (level.compareTo(EngineConfiguration.getInstance().getLoggerLevel()) < 0)
return;