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