externalize log

This commit is contained in:
FalsePattern committed 2022-08-23 21:01:19 +02:00
1 parent d902e8eb78
commit f1004e4e75
20 files changed
+78 -52

No files matched your search

@@ -20,9 +20,8 @@
*/
package com.falsepattern.lib.internal.proxy;
import com.falsepattern.lib.config.ConfigException;
import com.falsepattern.lib.config.ConfigurationManager;
import com.falsepattern.lib.internal.FalsePatternLib;
import com.falsepattern.lib.internal.Share;
import com.falsepattern.lib.internal.config.LibraryConfig;
import com.falsepattern.lib.internal.impl.config.ConfigSyncEventHandler;
import com.falsepattern.lib.internal.impl.config.ConfigurationManagerImpl;
@@ -58,22 +57,22 @@ public class CommonProxy {
public void preInit(FMLPreInitializationEvent e) {
ConfigurationManagerImpl.registerBus();
if (LibraryConfig.ENABLE_UPDATE_CHECKER) {
FalsePatternLib.getLog().info("Launching asynchronous update check.");
Share.LOG.info("Launching asynchronous update check.");
updatesFuture = UpdateChecker.fetchUpdatesAsync(FalsePatternLib.UPDATE_URL).thenApplyAsync(updates -> {
if (updates == null) {
updates = Collections.emptyList();
}
if (updates.isEmpty()) {
FalsePatternLib.getLog().info("No updates found.");
Share.LOG.info("No updates found.");
} else {
FalsePatternLib.getLog().info("Found {} updates.", updates.size());
Share.LOG.info("Found {} updates.", updates.size());
for (val update : updates) {
update.log(FalsePatternLib.getLog());
update.log(Share.LOG);
}
}
return updates;
}).exceptionally(ex -> {
FalsePatternLib.getLog().error("Failed to check for updates!", ex);
Share.LOG.error("Failed to check for updates!", ex);
return Collections.emptyList();
});
} else {