add debug log for request
This commit is contained in:
parent
fbf0a6d3ba
commit
59efd63930
|
@ -1,5 +1,6 @@
|
||||||
using System.Buffers.Binary;
|
using System.Buffers.Binary;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
|
using AscNet.Common;
|
||||||
using AscNet.Common.Util;
|
using AscNet.Common.Util;
|
||||||
using MessagePack;
|
using MessagePack;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
@ -80,11 +81,15 @@ namespace AscNet.GameServer
|
||||||
RequestPacketHandlerDelegate? requestPacketHandler = PacketFactory.GetRequestPacketHandler(request.Name);
|
RequestPacketHandlerDelegate? requestPacketHandler = PacketFactory.GetRequestPacketHandler(request.Name);
|
||||||
if (requestPacketHandler is not null)
|
if (requestPacketHandler is not null)
|
||||||
{
|
{
|
||||||
c.Log(request.Name);
|
if (Common.Common.config.VerboseLevel > VerboseLevel.Silent)
|
||||||
|
c.Log($"{request.Name}{(Common.Common.config.VerboseLevel >= VerboseLevel.Debug ? (", " + JsonConvert.SerializeObject(MessagePackSerializer.Typeless.Deserialize(request.Content))) : "")}");
|
||||||
requestPacketHandler.Invoke(this, request);
|
requestPacketHandler.Invoke(this, request);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
c.Warn($"{request.Name} handler not found!");
|
{
|
||||||
|
if (Common.Common.config.VerboseLevel > VerboseLevel.Silent)
|
||||||
|
c.Warn($"{request.Name} handler not found!{(Common.Common.config.VerboseLevel >= VerboseLevel.Debug ? (", " + JsonConvert.SerializeObject(MessagePackSerializer.Typeless.Deserialize(request.Content))) : "")}");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Packet.ContentType.Push:
|
case Packet.ContentType.Push:
|
||||||
Packet.Push push = MessagePackSerializer.Deserialize<Packet.Push>(packet.Content);
|
Packet.Push push = MessagePackSerializer.Deserialize<Packet.Push>(packet.Content);
|
||||||
|
|
|
@ -8,6 +8,12 @@ namespace AscNet
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Logger.c.Log("Starting...");
|
Logger.c.Log("Starting...");
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
if (Common.Common.config.VerboseLevel < Common.VerboseLevel.Debug)
|
||||||
|
Common.Common.config.VerboseLevel = Common.VerboseLevel.Debug;
|
||||||
|
#endif
|
||||||
|
|
||||||
PacketFactory.LoadPacketHandlers();
|
PacketFactory.LoadPacketHandlers();
|
||||||
Task.Run(GameServer.Server.Instance.Start);
|
Task.Run(GameServer.Server.Instance.Start);
|
||||||
SDKServer.SDKServer.Main(args);
|
SDKServer.SDKServer.Main(args);
|
||||||
|
|
Loading…
Reference in New Issue