Skip to content

Commit

Permalink
removed logging
Browse files Browse the repository at this point in the history
  • Loading branch information
breitnw committed Jul 17, 2024
1 parent a441ada commit 37e4737
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 404 deletions.
20 changes: 0 additions & 20 deletions src/main/java/org/prlprg/AppConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ public final class AppConfig extends Config {
public static final OptimizationLogLevel OPTIMIZATION_LOG_LEVEL =
get("OPTIMIZATION_LOG_LEVEL", OptimizationLogLevel.NONE);

/**
* How to log RDS reads and writes. Useful for diagnosing misalignments between input and output
* streams.
*
* <p><b>Default:</b>: {@link RDSLogLevel#NONE}
*/
public static final RDSLogLevel RDS_LOG_LEVEL = get("RDS_LOG_LEVEL", RDSLogLevel.NONE);

public enum CfgDebugLevel {
/** No extra checks. */
NONE,
Expand All @@ -82,18 +74,6 @@ public enum OptimizationLogLevel implements Comparable<OptimizationLogLevel> {
/** Log every optimization pass <i>and</i> every inner {@link CodeObject} it's applied to. */
ALL,
}

public enum RDSLogLevel implements Comparable<RDSLogLevel> {
/** Don't log any RDS input or output */
NONE,
/** Only log RDS input and output directly from tests */
TEST,
/**
* Log general RDS input and output, such as from base initialization (WARNING: logging general
* output may cause very large files to be generated, or even lead to out-of-memory errors)
*/
GENERAL,
}
}

/**
Expand Down
11 changes: 1 addition & 10 deletions src/main/java/org/prlprg/rds/RDSInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@

class RDSInputStream implements Closeable {
private final DataInputStream in;
private final RDSLogger logger;

RDSInputStream(InputStream in, RDSLogger logger) {
RDSInputStream(InputStream in) {
this.in = new DataInputStream(in);
this.logger = logger;
}

@Override
Expand All @@ -28,33 +26,28 @@ public void close() throws IOException {
*/
public int readRaw() throws IOException {
var input = in.read();
logger.log(input);
return input;
}

public byte readByte() throws IOException {
var input = in.readByte();
logger.log(input);
return input;
}

public int readInt() throws IOException {
var input = in.readInt();
logger.log(input);
return input;
}

public double readDouble() throws IOException {
var input = in.readDouble();
logger.log(input);
return input;
}

public String readString(int natEncSize, Charset charset) throws IOException {
var buf = new byte[natEncSize];
in.readFully(buf, 0, natEncSize);
var input = new String(buf, charset);
logger.log(input);
return input;
}

Expand All @@ -64,7 +57,6 @@ public int[] readInts(int length) throws IOException {
var n = in.readInt();
ints[i] = n;
}
logger.logInts(ints);
return ints;
}

Expand All @@ -74,7 +66,6 @@ public double[] readDoubles(int length) throws IOException {
var n = in.readDouble();
doubles[i] = n;
}
logger.logDoubles(doubles);
return doubles;
}
}
121 changes: 0 additions & 121 deletions src/main/java/org/prlprg/rds/RDSLogger.java

This file was deleted.

10 changes: 1 addition & 9 deletions src/main/java/org/prlprg/rds/RDSOutputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@

public class RDSOutputStream implements Closeable {
private final DataOutputStream out;
private final RDSLogger logger;

RDSOutputStream(OutputStream out, RDSLogger logger) {
RDSOutputStream(OutputStream out) {
this.out = new DataOutputStream(out);
this.logger = logger;
}

@Override
Expand All @@ -21,17 +19,14 @@ public void close() throws IOException {

public void writeByte(byte v) throws IOException {
out.writeByte(v);
logger.log(v);
}

public void writeInt(int v) throws IOException {
out.writeInt(v);
logger.log(v);
}

public void writeDouble(double v) throws IOException {
out.writeDouble(v);
logger.log(v);
}

/**
Expand All @@ -43,20 +38,17 @@ public void writeDouble(double v) throws IOException {
*/
public void writeBytes(byte[] v) throws IOException {
out.write(v);
logger.logBytes(v);
}

public void writeInts(int[] v) throws IOException {
for (int e : v) {
out.writeInt(e);
}
logger.logInts(v);
}

public void writeDoubles(double[] v) throws IOException {
for (double e : v) {
out.writeDouble(e);
}
logger.logDoubles(v);
}
}
Loading

0 comments on commit 37e4737

Please sign in to comment.