Better logger support

This commit is contained in:
MattBDev
2020-10-06 14:44:33 -04:00
parent 96dcb95b7c
commit f5a42c63a7
27 changed files with 124 additions and 114 deletions

View File

@ -44,6 +44,8 @@ import java.util.UUID;
import java.util.concurrent.Future;
import javax.annotation.Nullable;
import static org.slf4j.LoggerFactory.getLogger;
public class MCAChunk implements IChunk {
public final boolean[] hasSections = new boolean[16];
@ -308,7 +310,7 @@ public class MCAChunk implements IChunk {
Object value = state.getState(property);
String valueStr = value.toString();
if (Character.isUpperCase(valueStr.charAt(0))) {
System.out.println("Invalid uppercase value " + value);
getLogger(MCAChunk.class).warn("Invalid uppercase value {}", value);
valueStr = valueStr.toLowerCase(Locale.ROOT);
}
out.writeNamedTag(key, valueStr);

View File

@ -272,7 +272,7 @@ public class MCAFile extends ExtentBatchProcessorHolder implements Trimable, ICh
try (NBTInputStream nis = getChunkIS(offset)) {
chunk.read(nis, false);
}
System.out.println("TODO multithreaded"); // TODO
//TODO multithreaded
return chunk;
}

View File

@ -6,6 +6,8 @@ import com.sk89q.jnbt.NBTInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import static org.slf4j.LoggerFactory.getLogger;
public class StreamDelegate {
private static final byte[][] ZERO_KEYS = new byte[0][];
private static final StreamDelegate[] ZERO_VALUES = new StreamDelegate[0];
@ -39,7 +41,7 @@ public class StreamDelegate {
private StreamDelegate add(String name, StreamDelegate scope) {
if (valueReader != null) {
System.out.println("Scope " + name + " | " + scope + " may not run, as the stream is only read once, and a value reader is already set");
getLogger(StreamDelegate.class).warn("Scope {} | {} may not run, as the stream is only read once, and a value reader is already set", name, scope);
}
byte[] bytes = name.getBytes(NBTConstants.CHARSET);
int maxSize = bytes.length;
@ -167,7 +169,7 @@ public class StreamDelegate {
public StreamDelegate withValue(ValueReader valueReader) {
if (keys.length != 0) {
System.out.println("Reader " + valueReader + " may not run, as the stream is only read once, and a value reader is already set");
getLogger(StreamDelegate.class).warn("Reader {} may not run, as the stream is only read once, and a value reader is already set", valueReader);
}
this.valueReader = valueReader;
return this;