null logger
This commit is contained in:
parent
0bd3e98253
commit
2b26886b17
5 changed files with 21 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
||||||
import org.xbib.config.ConfigLogger;
|
import org.xbib.config.ConfigLogger;
|
||||||
|
import org.xbib.config.NullConfigLogger;
|
||||||
import org.xbib.config.SystemConfigLogger;
|
import org.xbib.config.SystemConfigLogger;
|
||||||
import org.xbib.settings.SettingsLoader;
|
import org.xbib.settings.SettingsLoader;
|
||||||
|
|
||||||
|
@ -6,7 +7,7 @@ module org.xbib.config {
|
||||||
exports org.xbib.config;
|
exports org.xbib.config;
|
||||||
uses ConfigLogger;
|
uses ConfigLogger;
|
||||||
uses SettingsLoader;
|
uses SettingsLoader;
|
||||||
provides ConfigLogger with SystemConfigLogger;
|
provides ConfigLogger with NullConfigLogger, SystemConfigLogger;
|
||||||
requires org.xbib.settings.api;
|
requires org.xbib.settings.api;
|
||||||
requires transitive org.xbib.settings.datastructures;
|
requires transitive org.xbib.settings.datastructures;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class ConfigLoader {
|
||||||
private static ConfigLogger createConfigLogger() {
|
private static ConfigLogger createConfigLogger() {
|
||||||
ServiceLoader<ConfigLogger> serviceLoader = ServiceLoader.load(ConfigLogger.class);
|
ServiceLoader<ConfigLogger> serviceLoader = ServiceLoader.load(ConfigLogger.class);
|
||||||
Optional<ConfigLogger> optionalConfigLogger = serviceLoader.findFirst();
|
Optional<ConfigLogger> optionalConfigLogger = serviceLoader.findFirst();
|
||||||
return optionalConfigLogger.orElse(new SystemConfigLogger());
|
return optionalConfigLogger.orElse(new NullConfigLogger());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final ConfigLoader configLoader = new ConfigLoader().withLogger(createConfigLogger());
|
private static final ConfigLoader configLoader = new ConfigLoader().withLogger(createConfigLogger());
|
||||||
|
|
16
config/src/main/java/org/xbib/config/NullConfigLogger.java
Normal file
16
config/src/main/java/org/xbib/config/NullConfigLogger.java
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
package org.xbib.config;
|
||||||
|
|
||||||
|
public class NullConfigLogger implements ConfigLogger {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(String string) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(String message) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(String message) {
|
||||||
|
}
|
||||||
|
}
|
|
@ -1 +1,2 @@
|
||||||
|
org.xbib.config.NullConfigLogger
|
||||||
org.xbib.config.SystemConfigLogger
|
org.xbib.config.SystemConfigLogger
|
|
@ -17,7 +17,7 @@ public class DatastructureSettings implements Settings {
|
||||||
|
|
||||||
private final TinyMap<String, String> map;
|
private final TinyMap<String, String> map;
|
||||||
|
|
||||||
protected DatastructureSettings(TinyMap<String, String> map) {
|
DatastructureSettings(TinyMap<String, String> map) {
|
||||||
this.map = map;
|
this.map = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue