Server and EntityEventManager debug logging can be enabled in release builds by enabling verbose logging, DebugConsole.ThrowError logs stacktraces

This commit is contained in:
Regalis
2017-06-03 19:01:39 +03:00
parent 1f8460e8ad
commit 96c425414c
4 changed files with 66 additions and 48 deletions

View File

@@ -135,9 +135,10 @@ namespace Barotrauma.Networking
catch (Exception e)
{
#if DEBUG
DebugConsole.ThrowError("Failed to read event for entity \"" + bufferedEvent.TargetEntity.ToString() + "\"!", e);
#endif
if (GameSettings.VerboseLogging)
{
DebugConsole.ThrowError("Failed to read event for entity \"" + bufferedEvent.TargetEntity.ToString() + "!", e);
}
}
bufferedEvent.IsProcessed = true;
@@ -326,23 +327,27 @@ namespace Barotrauma.Networking
//skip the event if we've already received it or if the entity isn't found
if (thisEventID != (UInt16)(sender.lastSentEntityEventID + 1) || entity == null)
{
#if DEBUG
if (thisEventID != (UInt16)(sender.lastSentEntityEventID + 1))
if (GameSettings.VerboseLogging)
{
DebugConsole.NewMessage("received msg " + thisEventID, Microsoft.Xna.Framework.Color.Red);
if (thisEventID != (UInt16) (sender.lastSentEntityEventID + 1))
{
DebugConsole.NewMessage("received msg " + thisEventID, Microsoft.Xna.Framework.Color.Red);
}
else if (entity == null)
{
DebugConsole.NewMessage(
"received msg " + thisEventID + ", entity " + entityID + " not found",
Microsoft.Xna.Framework.Color.Red);
}
}
else if (entity == null)
{
DebugConsole.NewMessage("received msg " + thisEventID + ", entity " + entityID + " not found", Microsoft.Xna.Framework.Color.Red);
}
#endif
msg.Position += msgLength * 8;
}
else
{
#if DEBUG
DebugConsole.NewMessage("received msg " + thisEventID, Microsoft.Xna.Framework.Color.Green);
#endif
if (GameSettings.VerboseLogging)
{
DebugConsole.NewMessage("received msg " + thisEventID, Microsoft.Xna.Framework.Color.Green);
}
UInt16 characterStateID = msg.ReadUInt16();