mirror of
https://git.lewd.wtf/PGR/ascnet
synced 2025-12-13 02:14:37 +01:00
add support for loglevel color configuration
This commit is contained in:
@@ -98,6 +98,7 @@ namespace AscNet.GameServer
|
||||
|
||||
public static void LoadPacketHandlers()
|
||||
{
|
||||
log.LogLevelColor[LogLevel.INFO] = ConsoleColor.White;
|
||||
LoadRequestPacketHandlers();
|
||||
}
|
||||
|
||||
@@ -111,7 +112,8 @@ namespace AscNet.GameServer
|
||||
foreach (var method in classes.SelectMany(t => t.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)))
|
||||
{
|
||||
var attr = method.GetCustomAttribute<RequestPacketHandler>(false);
|
||||
if (attr == null || ReqHandlers.ContainsKey(attr.Name)) continue;
|
||||
if (attr == null || ReqHandlers.ContainsKey(attr.Name))
|
||||
continue;
|
||||
ReqHandlers.Add(attr.Name, (RequestPacketHandlerDelegate)Delegate.CreateDelegate(typeof(RequestPacketHandlerDelegate), method));
|
||||
#if DEBUG
|
||||
log.Info($"Loaded {method.Name}");
|
||||
|
||||
@@ -23,8 +23,8 @@ namespace AscNet.GameServer
|
||||
this.id = id;
|
||||
client = tcpClient;
|
||||
// TODO: add session based configuration? maybe from database?
|
||||
log = new(typeof(Session), LogLevel.DEBUG, LogLevel.DEBUG);
|
||||
|
||||
log = new(typeof(Session), id, LogLevel.DEBUG, LogLevel.DEBUG);
|
||||
log.LogLevelColor[LogLevel.INFO] = ConsoleColor.Cyan;
|
||||
Task.Run(ClientLoop);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user