Skip to content

Commit

Permalink
Restructured log levels. Made 'undefined packet' log as debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Nan1t committed Jan 23, 2022
1 parent 4bdf856 commit cb02cc4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf buf, List<Object> out)

ctx.fireChannelRead(packet);
} else {
Logger.warning("Undefined incoming packet: 0x" + Integer.toHexString(packetId));
Logger.debug("Undefined incoming packet: 0x" + Integer.toHexString(packetId));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected void encode(ChannelHandlerContext ctx, Packet packet, ByteBuf out) thr
Logger.debug("Sending %s packet (%d bytes)", packet.toString(), msg.readableBytes());
}
} catch (Exception e) {
Logger.warning("Cannot encode packet 0x%s: %s", Integer.toHexString(packetId), e.getMessage());
Logger.error("Cannot encode packet 0x%s: %s", Integer.toHexString(packetId), e.getMessage());
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/ru/nanit/limbo/util/Logger.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ private static String getTime() {

public enum Level {

INFO ("INFO", 0),
DEBUG ("DEBUG", 1),
ERROR("ERROR", 1),
WARNING("WARNING", 2),
ERROR("ERROR", 3);
INFO ("INFO", 3),
DEBUG ("DEBUG", 4);

private final String display;
private final int index;
Expand Down
14 changes: 7 additions & 7 deletions src/main/resources/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ infoForwarding:
# Read timeout for connections in milliseconds
readTimeout: 30000

# Define debug level. On release, i recommend to use 0 level, since
# there are many useless for release information about ping, received packets, etc.
# Levels:
# 0 - Display only useful info
# 1 - Display info and some debug
# 2 - Display info and warnings
# 3 - Display info, warnings, errors
# Define log level. On release, I'd recommend to use level 3
# Log levels:
# 0 - Display nothing
# 1 - Display only errors
# 2 - Display errors, warnings
# 3 - Display errors, warnings, info
# 4 - Display errors, warnings, info, debug
debugLevel: 3

# Warning! Do not touch params of this block, if you not completely sure what is this!
Expand Down

0 comments on commit cb02cc4

Please sign in to comment.