added nlog logging (todo: custom logger for packets)

This commit is contained in:
Tahir Akhlaq 2016-06-14 05:09:30 +01:00
parent c5516511b0
commit ed0a0a58f7
36 changed files with 5430 additions and 310 deletions

View file

@ -6,6 +6,7 @@ using System.Threading;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.packets;
using FFXIVClassic.Common;
using NLog;
using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.lua;
@ -39,7 +40,7 @@ namespace FFXIVClassic_Map_Server
private void connectionHealth()
{
Program.Log.Info(String.Format("Connection Health thread started; it will run every {0} seconds.", HEALTH_THREAD_SLEEP_TIME));
Program.Log.Info("Connection Health thread started; it will run every {0} seconds.", HEALTH_THREAD_SLEEP_TIME);
while (!killHealthThread)
{
lock (mConnectedPlayerList)
@ -77,7 +78,7 @@ namespace FFXIVClassic_Map_Server
mStaticActors = new StaticActors(STATIC_ACTORS_PATH);
gamedataItems = Database.getItemGamedata();
Program.Log.Info(String.Format("Loaded {0} items.", gamedataItems.Count));
Program.Log.Info("Loaded {0} items.", gamedataItems.Count);
mWorldManager = new WorldManager(this);
mWorldManager.LoadZoneList();
@ -113,7 +114,7 @@ namespace FFXIVClassic_Map_Server
}
Console.ForegroundColor = ConsoleColor.White;
Program.Log.Debug(String.Format("Map Server has started @ {0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port));
Program.Log.Debug("Map Server has started @ {0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port);
Console.ForegroundColor = ConsoleColor.Gray;
mProcessor = new PacketProcessor(this, mConnectedPlayerList, mConnectionList);
@ -150,7 +151,7 @@ namespace FFXIVClassic_Map_Server
mConnectionList.Add(conn);
}
Program.Log.Status(String.Format("Connection {0}:{1} has connected.", (conn.socket.RemoteEndPoint as IPEndPoint).Address, (conn.socket.RemoteEndPoint as IPEndPoint).Port));
Program.Log.Info("Connection {0}:{1} has connected.", (conn.socket.RemoteEndPoint as IPEndPoint).Address, (conn.socket.RemoteEndPoint as IPEndPoint).Port);
//Queue recieving of data from the connection
conn.socket.BeginReceive(conn.buffer, 0, conn.buffer.Length, SocketFlags.None, new AsyncCallback(receiveCallback), conn);
//Queue the accept of the next incomming connection
@ -217,7 +218,7 @@ namespace FFXIVClassic_Map_Server
mConnectionList.Remove(conn);
}
if (conn.connType == BasePacket.TYPE_ZONE)
Program.Log.Status(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner));
Program.Log.Info("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner);
return;
}
@ -261,7 +262,7 @@ namespace FFXIVClassic_Map_Server
}
else
{
Program.Log.Status(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner));
Program.Log.Info("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner);
lock (mConnectionList)
{
@ -273,7 +274,7 @@ namespace FFXIVClassic_Map_Server
{
if (conn.socket != null)
{
Program.Log.Status(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner));
Program.Log.Info("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner);
lock (mConnectionList)
{