change to logger

This commit is contained in:
mcrcortex
2025-05-30 20:48:37 +10:00
parent 03bede4067
commit 34c5c71d77
9 changed files with 16 additions and 12 deletions

View File

@@ -175,7 +175,7 @@ public class Shader extends TrackedObject {
String log = GL20C.glGetShaderInfoLog(shader); String log = GL20C.glGetShaderInfoLog(shader);
if (!log.isEmpty()) { if (!log.isEmpty()) {
System.err.println(log); Logger.warn(log);
} }
int result = GL20C.glGetShaderi(shader, GL20C.GL_COMPILE_STATUS); int result = GL20C.glGetShaderi(shader, GL20C.GL_COMPILE_STATUS);

View File

@@ -8,6 +8,7 @@ import me.cortex.voxy.client.core.gl.Capabilities;
import me.cortex.voxy.client.core.model.bakery.ModelTextureBakery; import me.cortex.voxy.client.core.model.bakery.ModelTextureBakery;
import me.cortex.voxy.client.core.rendering.util.RawDownloadStream; import me.cortex.voxy.client.core.rendering.util.RawDownloadStream;
import me.cortex.voxy.client.core.rendering.util.UploadStream; import me.cortex.voxy.client.core.rendering.util.UploadStream;
import me.cortex.voxy.common.Logger;
import me.cortex.voxy.common.util.MemoryBuffer; import me.cortex.voxy.common.util.MemoryBuffer;
import me.cortex.voxy.common.world.other.Mapper; import me.cortex.voxy.common.world.other.Mapper;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@@ -490,7 +491,7 @@ public class ModelFactory {
throw new IllegalStateException("Biome was put in an id that was not null"); throw new IllegalStateException("Biome was put in an id that was not null");
} }
if (oldBiome == biome) { if (oldBiome == biome) {
System.err.println("Biome added was a duplicate"); Logger.error("Biome added was a duplicate");
} }
int i = 0; int i = 0;

View File

@@ -3,6 +3,7 @@ package me.cortex.voxy.common.config.storage.other;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import me.cortex.voxy.common.Logger;
import me.cortex.voxy.common.config.storage.StorageBackend; import me.cortex.voxy.common.config.storage.StorageBackend;
import me.cortex.voxy.common.config.ConfigBuildCtx; import me.cortex.voxy.common.config.ConfigBuildCtx;
import me.cortex.voxy.common.config.storage.StorageConfig; import me.cortex.voxy.common.config.storage.StorageConfig;
@@ -100,7 +101,7 @@ public class FragmentedStorageBackendAdaptor extends StorageBackend {
} }
if (verification.size() != 1) { if (verification.size() != 1) {
System.err.println("Error id mapping not matching across all fragments, attempting to recover"); Logger.error("Error id mapping not matching across all fragments, attempting to recover");
Object2IntMap.Entry<Int2ObjectOpenHashMap<EqualingArray>> maxEntry = null; Object2IntMap.Entry<Int2ObjectOpenHashMap<EqualingArray>> maxEntry = null;
for (var entry : verification.object2IntEntrySet()) { for (var entry : verification.object2IntEntrySet()) {
if (maxEntry == null) { maxEntry = entry; } if (maxEntry == null) { maxEntry = entry; }

View File

@@ -274,8 +274,7 @@ public class ServiceThreadPool {
} }
private void handleUncaughtException(Thread thread, Throwable throwable) { private void handleUncaughtException(Thread thread, Throwable throwable) {
System.err.println("Service worker thread has exploded unexpectedly! this is really not good very very bad."); Logger.error("Service worker thread has exploded unexpectedly! this is really not good very very bad.", throwable);
throwable.printStackTrace();
} }
public void shutdown() { public void shutdown() {

View File

@@ -2,6 +2,7 @@ package me.cortex.voxy.common.world;
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import me.cortex.voxy.common.Logger;
import me.cortex.voxy.common.util.VolatileHolder; import me.cortex.voxy.common.util.VolatileHolder;
import me.cortex.voxy.common.world.other.Mapper; import me.cortex.voxy.common.world.other.Mapper;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -115,7 +116,7 @@ public class ActiveSectionTracker {
if (status < 0) { if (status < 0) {
//TODO: Instead if throwing an exception do something better, like attempting to regen //TODO: Instead if throwing an exception do something better, like attempting to regen
//throw new IllegalStateException("Unable to load section: "); //throw new IllegalStateException("Unable to load section: ");
System.err.println("Unable to load section " + section.key + " setting to air"); Logger.error("Unable to load section " + section.key + " setting to air");
status = 1; status = 1;
} }

View File

@@ -1,6 +1,7 @@
package me.cortex.voxy.common.world; package me.cortex.voxy.common.world;
import it.unimi.dsi.fastutil.longs.Long2ShortOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ShortOpenHashMap;
import me.cortex.voxy.common.Logger;
import me.cortex.voxy.common.util.MemoryBuffer; import me.cortex.voxy.common.util.MemoryBuffer;
import me.cortex.voxy.common.util.UnsafeUtil; import me.cortex.voxy.common.util.UnsafeUtil;
import me.cortex.voxy.common.world.other.Mapper; import me.cortex.voxy.common.world.other.Mapper;
@@ -120,7 +121,7 @@ public class SaveLoadSystem {
if (section.key != key) { if (section.key != key) {
//throw new IllegalStateException("Decompressed section not the same as requested. got: " + key + " expected: " + section.key); //throw new IllegalStateException("Decompressed section not the same as requested. got: " + key + " expected: " + section.key);
System.err.println("Decompressed section not the same as requested. got: " + key + " expected: " + section.key); Logger.error("Decompressed section not the same as requested. got: " + key + " expected: " + section.key);
return false; return false;
} }
@@ -145,7 +146,7 @@ public class SaveLoadSystem {
long expectedHash = MemoryUtil.memGetLong(ptr); ptr += 8; if (VERIFY_MEMORY_ACCESS && data.size<(ptr-data.address)) throw new IllegalStateException("Memory access OOB"); long expectedHash = MemoryUtil.memGetLong(ptr); ptr += 8; if (VERIFY_MEMORY_ACCESS && data.size<(ptr-data.address)) throw new IllegalStateException("Memory access OOB");
if (expectedHash != hash) { if (expectedHash != hash) {
//throw new IllegalStateException("Hash mismatch got: " + hash + " expected: " + expectedHash); //throw new IllegalStateException("Hash mismatch got: " + hash + " expected: " + expectedHash);
System.err.println("Hash mismatch got: " + hash + " expected: " + expectedHash + " removing region"); Logger.error("Hash mismatch got: " + hash + " expected: " + expectedHash + " removing region");
return false; return false;
} }
} }

View File

@@ -1,6 +1,7 @@
package me.cortex.voxy.common.world.other; package me.cortex.voxy.common.world.other;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import me.cortex.voxy.common.Logger;
import me.cortex.voxy.common.config.IMappingStorage; import me.cortex.voxy.common.config.IMappingStorage;
import me.cortex.voxy.common.config.section.SectionStorage; import me.cortex.voxy.common.config.section.SectionStorage;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@@ -99,7 +100,7 @@ public class Mapper {
if (entryType == BLOCK_STATE_TYPE) { if (entryType == BLOCK_STATE_TYPE) {
var sentry = StateEntry.deserialize(id, entry.getValue()); var sentry = StateEntry.deserialize(id, entry.getValue());
if (sentry.state.isAir()) { if (sentry.state.isAir()) {
System.err.println("Deserialization was air, removed block"); Logger.error("Deserialization was air, removed block");
sentryErrors.add(new Pair<>(entry.getValue(), id)); sentryErrors.add(new Pair<>(entry.getValue(), id));
continue; continue;
} }

View File

@@ -69,7 +69,7 @@ public class SectionSavingService {
public void shutdown() { public void shutdown() {
if (this.threads.getJobCount() != 0) { if (this.threads.getJobCount() != 0) {
System.err.println("Voxy section saving still in progress, estimated " + this.threads.getJobCount() + " sections remaining."); Logger.error("Voxy section saving still in progress, estimated " + this.threads.getJobCount() + " sections remaining.");
while (this.threads.getJobCount() != 0) { while (this.threads.getJobCount() != 0) {
Thread.onSpinWait(); Thread.onSpinWait();
} }

View File

@@ -327,7 +327,7 @@ public class WorldImporter implements IDataImporter {
//TODO: create memory copy for each section //TODO: create memory copy for each section
if (regionFile.size < ((sectorCount-1) + sectorStart) * 4096L) { if (regionFile.size < ((sectorCount-1) + sectorStart) * 4096L) {
System.err.println("Cannot access chunk sector as it goes out of bounds. start bytes: " + (sectorStart*4096) + " sector count: " + sectorCount + " fileSize: " + regionFile.size); Logger.warn("Cannot access chunk sector as it goes out of bounds. start bytes: " + (sectorStart*4096) + " sector count: " + sectorCount + " fileSize: " + regionFile.size);
continue; continue;
} }
@@ -341,7 +341,7 @@ public class WorldImporter implements IDataImporter {
} else { } else {
int n = m - 1; int n = m - 1;
if (regionFile.size < (n + sectorStart*4096L)) { if (regionFile.size < (n + sectorStart*4096L)) {
System.err.println("Chunk stream to small"); Logger.warn("Chunk stream to small");
} else if ((b & 128) != 0) { } else if ((b & 128) != 0) {
if (n != 0) { if (n != 0) {
Logger.error("Chunk has both internal and external streams"); Logger.error("Chunk has both internal and external streams");