Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
fix logger
Browse files Browse the repository at this point in the history
  • Loading branch information
mist475 committed Nov 2, 2023
1 parent ea52807 commit a365d17
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
19 changes: 2 additions & 17 deletions src/main/java/com/prupe/mcpatcher/MCLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class MCLogger {
private long lastFloodReport;
private int floodCount;
private long lastMessage = System.currentTimeMillis();
private long lastLogEvery = lastMessage;

public static MCLogger getLogger(String category) {
return getLogger(category, category);
Expand Down Expand Up @@ -60,7 +59,7 @@ public String format(LogRecord record) {
prefix.append("\n");
message = message.substring(1);
}
return prefix + "[" + MCLogger.this.logPrefix + "] " + level + ": " + message;
return prefix + "[" + MCLogger.this.logPrefix + "] " + level.toString() + ": " + message;
}
}
};
Expand Down Expand Up @@ -116,16 +115,12 @@ public boolean isLoggable(Level level) {
return logger.isLoggable(level);
}

public void setLevel(Level level) {
logger.setLevel(level);
}

public void log(Level level, String format, Object... params) {
if (isLoggable(level)) {
if (level.intValue() >= FLOOD_LEVEL && !checkFlood()) {
return;
}
logger.log(level, format, params);
logger.log(level, String.format(format, params));
}
}

Expand Down Expand Up @@ -161,16 +156,6 @@ public void finest(String format, Object... params) {
log(Level.FINEST, format, params);
}

public boolean logEvery(long milliseconds) {
long now = System.currentTimeMillis();
if (now - lastLogEvery > milliseconds) {
lastLogEvery = now;
return true;
} else {
return false;
}
}

private static class ErrorLevel extends Level {

protected ErrorLevel() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/prupe/mcpatcher/mal/tile/TileLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void afterChange() {
for (TileLoader loader : loaders) {
if (!loader.tilesToRegister.isEmpty()) {
loader.subLogger.warning(
"could not load all %s tiles (%d remaining): %s",
"could not load all %s tiles (%d remaining)",
loader.mapName,
loader.tilesToRegister.size());
loader.tilesToRegister.clear();
Expand Down

0 comments on commit a365d17

Please sign in to comment.