change logger (netconnection)
This commit is contained in:
parent
77b5a34a33
commit
bb64949927
2 changed files with 10 additions and 10 deletions
|
@ -18,7 +18,7 @@ public enum Log {
|
||||||
TICK("Tick"),
|
TICK("Tick"),
|
||||||
SOUND("Sound"),
|
SOUND("Sound"),
|
||||||
JNI("JNI"),
|
JNI("JNI"),
|
||||||
NETTY("Netty");
|
NETWORK("Network");
|
||||||
|
|
||||||
private static class LogMessage {
|
private static class LogMessage {
|
||||||
private final LogLevel level;
|
private final LogLevel level;
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class NetConnection extends SimpleChannelInboundHandler<Packet> {
|
||||||
this.setConnectionState(PacketRegistry.HANDSHAKE);
|
this.setConnectionState(PacketRegistry.HANDSHAKE);
|
||||||
}
|
}
|
||||||
catch(Throwable t) {
|
catch(Throwable t) {
|
||||||
Log.JNI.error(t, "Fehler beim Aufbauen der Verbindung für Handshake");
|
Log.NETWORK.error(t, "Fehler beim Aufbauen der Verbindung für Handshake");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public class NetConnection extends SimpleChannelInboundHandler<Packet> {
|
||||||
this.channel.attr(ATTR_STATE).set(newState);
|
this.channel.attr(ATTR_STATE).set(newState);
|
||||||
this.channel.config().setAutoRead(true);
|
this.channel.config().setAutoRead(true);
|
||||||
if(DEBUG)
|
if(DEBUG)
|
||||||
Log.SYSTEM.info("Automatisches Lesen eingeschaltet");
|
Log.NETWORK.info("Automatisches Lesen eingeschaltet");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void channelInactive(ChannelHandlerContext context) throws Exception {
|
public void channelInactive(ChannelHandlerContext context) throws Exception {
|
||||||
|
@ -70,7 +70,7 @@ public class NetConnection extends SimpleChannelInboundHandler<Packet> {
|
||||||
else {
|
else {
|
||||||
comp = "Interner Fehler: " + throwable;
|
comp = "Interner Fehler: " + throwable;
|
||||||
if(!(throwable instanceof ClosedChannelException))
|
if(!(throwable instanceof ClosedChannelException))
|
||||||
Log.SYSTEM.error(throwable, "Fehler in der Verbindung mit %s", this.getCutAddress());
|
Log.NETWORK.error(throwable, "Fehler in der Verbindung mit %s", this.getCutAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.closeChannel(comp);
|
this.closeChannel(comp);
|
||||||
|
@ -78,7 +78,7 @@ public class NetConnection extends SimpleChannelInboundHandler<Packet> {
|
||||||
|
|
||||||
protected void channelRead0(ChannelHandlerContext context, Packet packet) throws Exception {
|
protected void channelRead0(ChannelHandlerContext context, Packet packet) throws Exception {
|
||||||
if(DEBUG)
|
if(DEBUG)
|
||||||
Log.SYSTEM.info("EIN: [" + context.channel().attr(NetConnection.ATTR_STATE).get() + "] " + packet.getClass().getName());
|
Log.NETWORK.info("EIN: [" + context.channel().attr(NetConnection.ATTR_STATE).get() + "] " + packet.getClass().getName());
|
||||||
if(this.channel.isOpen()) {
|
if(this.channel.isOpen()) {
|
||||||
try {
|
try {
|
||||||
packet.processPacket(this.handler);
|
packet.processPacket(this.handler);
|
||||||
|
@ -137,7 +137,7 @@ public class NetConnection extends SimpleChannelInboundHandler<Packet> {
|
||||||
|
|
||||||
if(current != state) {
|
if(current != state) {
|
||||||
if(DEBUG)
|
if(DEBUG)
|
||||||
Log.SYSTEM.info("Automatisches Lesen ausgeschaltet");
|
Log.NETWORK.info("Automatisches Lesen ausgeschaltet");
|
||||||
this.channel.config().setAutoRead(false);
|
this.channel.config().setAutoRead(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ public class NetConnection extends SimpleChannelInboundHandler<Packet> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(DEBUG)
|
if(DEBUG)
|
||||||
Log.SYSTEM.info("AUS: [" + this.channel.attr(NetConnection.ATTR_STATE).get() + "] " + packet.getClass().getName());
|
Log.NETWORK.info("AUS: [" + this.channel.attr(NetConnection.ATTR_STATE).get() + "] " + packet.getClass().getName());
|
||||||
ChannelFuture future = this.channel.writeAndFlush(packet);
|
ChannelFuture future = this.channel.writeAndFlush(packet);
|
||||||
|
|
||||||
if(listeners != null) {
|
if(listeners != null) {
|
||||||
|
@ -164,7 +164,7 @@ public class NetConnection extends SimpleChannelInboundHandler<Packet> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(DEBUG)
|
if(DEBUG)
|
||||||
Log.SYSTEM.info("AUS: [" + NetConnection.this.channel.attr(NetConnection.ATTR_STATE).get() + "] " + packet.getClass().getName());
|
Log.NETWORK.info("AUS: [" + NetConnection.this.channel.attr(NetConnection.ATTR_STATE).get() + "] " + packet.getClass().getName());
|
||||||
ChannelFuture future = NetConnection.this.channel.writeAndFlush(packet);
|
ChannelFuture future = NetConnection.this.channel.writeAndFlush(packet);
|
||||||
|
|
||||||
if(listeners != null) {
|
if(listeners != null) {
|
||||||
|
@ -200,7 +200,7 @@ public class NetConnection extends SimpleChannelInboundHandler<Packet> {
|
||||||
if(this.channel != null)
|
if(this.channel != null)
|
||||||
this.channel.flush();
|
this.channel.flush();
|
||||||
if(DEBUG)
|
if(DEBUG)
|
||||||
Log.SYSTEM.info("Pakete synchronisiert");
|
Log.NETWORK.info("Pakete synchronisiert");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCutAddress() {
|
public String getCutAddress() {
|
||||||
|
@ -261,7 +261,7 @@ public class NetConnection extends SimpleChannelInboundHandler<Packet> {
|
||||||
this.handler.onDisconnect(this.exitReason != null ? this.exitReason : "Verbindung getrennt");
|
this.handler.onDisconnect(this.exitReason != null ? this.exitReason : "Verbindung getrennt");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Log.JNI.warn("handleDisconnection() zweifach aufgerufen");
|
Log.NETWORK.warn("handleDisconnection() zweifach aufgerufen");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue