mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-06 01:00:16 +00:00
better logging
This commit is contained in:
parent
f4984b1e9f
commit
70bca00d87
@ -14,7 +14,7 @@ namespace QSB.OrbSync
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CheckOrbCollision(ref bool __result, NomaiInterfaceSlot __instance, NomaiInterfaceOrb orb,
|
||||
public static bool CheckOrbCollision(ref bool __result, NomaiInterfaceSlot __instance, NomaiInterfaceOrb orb,
|
||||
bool ____ignoreDraggedOrbs, float ____radius, float ____exitRadius, ref NomaiInterfaceOrb ____occupyingOrb)
|
||||
{
|
||||
if (____ignoreDraggedOrbs && orb.IsBeingDragged())
|
||||
|
@ -1,4 +1,7 @@
|
||||
using OWML.Common;
|
||||
using OWML.Logging;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
||||
namespace QSB.Utility
|
||||
{
|
||||
@ -6,7 +9,20 @@ namespace QSB.Utility
|
||||
{
|
||||
public static void ToConsole(string message, MessageType type = MessageType.Message)
|
||||
{
|
||||
QSB.Helper.Console.WriteLine(message, type);
|
||||
var console = (ModSocketOutput)QSB.Helper.Console;
|
||||
var method = console.GetType()
|
||||
.GetMethods(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
|
||||
.Last(x => x.Name == "WriteLine");
|
||||
var callingType = GetCallingType(new StackTrace());
|
||||
if (callingType == "DebugLog")
|
||||
{
|
||||
callingType = GetCallingType(new StackTrace(), 2);
|
||||
}
|
||||
if (callingType == "DebugLog")
|
||||
{
|
||||
callingType = GetCallingType(new StackTrace(), 3);
|
||||
}
|
||||
method.Invoke(console, new object[] { type, message, callingType });
|
||||
}
|
||||
|
||||
public static void ToHud(string message)
|
||||
@ -40,5 +56,16 @@ namespace QSB.Utility
|
||||
DebugWrite($"* {name} {status}", messageType);
|
||||
}
|
||||
|
||||
private static string GetCallingType(StackTrace frame, int index = 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
return frame.GetFrame(index).GetMethod().DeclaringType.Name;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user