Skip to content

Commit

Permalink
feat: Adds exception message to logger for TCP Server and streamlines…
Browse files Browse the repository at this point in the history
… logger messages. (#2037)
  • Loading branch information
kamronbatman authored Dec 30, 2024
1 parent 60b97f8 commit 2fded43
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Projects/Server/Network/TcpServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static void Start()

foreach (var ipep in listeningAddresses)
{
logger.Information("Listening: {Address}:{Port}", ipep.Address, ipep.Port);
logger.Information("Listening: {Address}", ipep);
}

ListeningAddresses = listeningAddresses.ToArray();
Expand Down Expand Up @@ -107,16 +107,16 @@ public static Socket CreateListener(IPEndPoint ipep)
// WSAEADDRINUSE
if (se.ErrorCode == 10048)
{
logger.Warning("Listener: {Address}:{Port}: Failed (In Use)", ipep.Address, ipep.Port);
logger.Warning("Listener: {Address} Exception: {Reason}", ipep, "Currently in use");
}
// WSAEADDRNOTAVAIL
else if (se.ErrorCode == 10049)
{
logger.Warning("Listener {Address}:{Port}: Failed (Unavailable)", ipep.Address, ipep.Port);
logger.Warning("Listener {Address} Exception: {Reason}", ipep, "Unavailable");
}
else
{
logger.Warning(se, "Listener Exception:");
logger.Warning(se, "Listener {Address} Exception: {Reason}", ipep, se.Message);
}
}

Expand Down

0 comments on commit 2fded43

Please sign in to comment.