fix: Fixes structured logging (#1043)
- [X] Fixes various bugs in logging.
This commit is contained in:
parent
78bb4f4bb2
commit
6e69d25e33
31 changed files with 96 additions and 102 deletions
|
|
@ -343,13 +343,7 @@ public partial class NetState : IComparable<NetState>
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void LogInfo(string text)
|
||||
{
|
||||
logger.Information("Client: {0}: {1}", this, text);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void LogInfo(string format, params object[] args)
|
||||
{
|
||||
LogInfo(string.Format(format, args));
|
||||
logger.Information("Client: {NetState}: {Message}", this, text);
|
||||
}
|
||||
|
||||
public void AddMenu(IMenu menu)
|
||||
|
|
@ -861,7 +855,7 @@ public partial class NetState : IComparable<NetState>
|
|||
{
|
||||
if (ex.SocketErrorCode != SocketError.WouldBlock)
|
||||
{
|
||||
logger.Debug(ex, "Disconnected due to socket exception");
|
||||
logger.Debug(ex, "Disconnected due to a socket exception");
|
||||
Disconnect(string.Empty);
|
||||
}
|
||||
}
|
||||
|
|
@ -1127,13 +1121,6 @@ public partial class NetState : IComparable<NetState>
|
|||
|
||||
var count = TcpServer.Instances.Count;
|
||||
|
||||
if (a != null)
|
||||
{
|
||||
LogInfo("Disconnected. [{0} Online] [{1}]", count, a);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogInfo("Disconnected. [{0} Online]", count);
|
||||
}
|
||||
LogInfo(a != null ? $"Disconnected. [{count} Online] [{a}]" : $"Disconnected. [{count} Online]");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue