From 4ae06be523ea6a610f636eaa1e30038518534e0b Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Sun, 16 Oct 2016 19:28:40 +0200 Subject: [PATCH] Ajout d'un nouveau packet pour PandacubeCore --- .../java/util/network/packet/Packet.java | 2 + .../packets/global/PacketClientLogRecord.java | 76 +++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 src/fr/pandacube/java/util/network/packet/packets/global/PacketClientLogRecord.java diff --git a/src/fr/pandacube/java/util/network/packet/Packet.java b/src/fr/pandacube/java/util/network/packet/Packet.java index 8f9984f..2d192a9 100644 --- a/src/fr/pandacube/java/util/network/packet/Packet.java +++ b/src/fr/pandacube/java/util/network/packet/Packet.java @@ -18,6 +18,7 @@ import fr.pandacube.java.util.network.packet.packets.core_slave.PacketServerProc import fr.pandacube.java.util.network.packet.packets.core_slave.PacketServerProcessInput; import fr.pandacube.java.util.network.packet.packets.core_slave.PacketServerProcessQuery; import fr.pandacube.java.util.network.packet.packets.global.PacketClientAuthenticate; +import fr.pandacube.java.util.network.packet.packets.global.PacketClientLogRecord; import fr.pandacube.java.util.network.packet.packets.global.PacketServerCantAuthenticate; import fr.pandacube.java.util.network.packet.packets.global.PacketServerException; import fr.pandacube.java.util.network.packet.packets.web.PacketClientWebRequest; @@ -105,6 +106,7 @@ public abstract class Packet implements ByteSerializable { addPacket(PacketServerProcessQuery.class); addPacket(PacketClientAuthenticate.class); + addPacket(PacketClientLogRecord.class); addPacket(PacketServerCantAuthenticate.class); addPacket(PacketServerException.class); diff --git a/src/fr/pandacube/java/util/network/packet/packets/global/PacketClientLogRecord.java b/src/fr/pandacube/java/util/network/packet/packets/global/PacketClientLogRecord.java new file mode 100644 index 0000000..44c52b3 --- /dev/null +++ b/src/fr/pandacube/java/util/network/packet/packets/global/PacketClientLogRecord.java @@ -0,0 +1,76 @@ +package fr.pandacube.java.util.network.packet.packets.global; + +import fr.pandacube.java.util.network.packet.PacketClient; +import fr.pandacube.java.util.network.packet.bytebuffer.ByteBuffer; + +public class PacketClientLogRecord extends PacketClient { + + private long time; + private String level; + private String threadName; + private String message; + private String throwable; + + public PacketClientLogRecord() { + super((byte)0x51); + } + + @Override + public void deserializeFromByteBuffer(ByteBuffer buffer) { + time = buffer.getLong(); + level = buffer.getString(); + threadName = buffer.getString(); + message = buffer.getString(); + throwable = buffer.getString(); + } + + @Override + public void serializeToByteBuffer(ByteBuffer buffer) { + buffer.putLong(time); + buffer.putString(level); + buffer.putString(threadName); + buffer.putString(message); + buffer.putString(throwable); + } + + public long getTime() { + return time; + } + + public void setTime(long time) { + this.time = time; + } + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } + + public String getThreadName() { + return threadName; + } + + public void setThreadName(String threadName) { + this.threadName = threadName; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getThrowable() { + return throwable; + } + + public void setThrowable(String throwable) { + this.throwable = throwable; + } + +}