logging improvements

This commit is contained in:
rusefillc 2021-12-05 23:54:07 -05:00
parent 9549a56b9c
commit 5c1e3a2536
2 changed files with 13 additions and 1 deletions

View File

@ -127,7 +127,7 @@ public class IncomingDataBuffer {
while (cbb.length() < count) {
int timeout = (int) (startTimestamp + timeoutMs - System.currentTimeMillis());
if (timeout <= 0) {
log.info(loggingMessage + ": timeout. Got only " + cbb.length());
log.info(loggingMessage + ": timeout. Got only " + cbb.length() + " while expecting " + count);
return true; // timeout. Sad face.
}
try {

View File

@ -41,6 +41,18 @@ public interface IoStream extends WriteStream, Closeable, StreamStatistics {
return r.toString();
}
static String printByteArray(byte[] data) {
StringBuilder sb = new StringBuilder();
for (byte b : data) {
if (Character.isJavaIdentifierPart(b)) {
sb.append((char) b);
} else {
sb.append(' ');
}
}
return printHexBinary(data) + sb;
}
@NotNull
default BinaryProtocolServer.Packet readPacket() throws IOException {
short length = readShort();