Add stack dump function that takes an alternate printer outter. I've found that log4net can be slowish so, if one is generating A LOT of debug output, alternate printers are better
parent
f3b1efd889
commit
21dc5f4a1a
|
@ -1854,6 +1854,12 @@ namespace OpenSim.Framework
|
|||
/// Prints the call stack at any given point. Useful for debugging.
|
||||
/// </summary>
|
||||
public static void PrintCallStack()
|
||||
{
|
||||
PrintCallStack(m_log.DebugFormat);
|
||||
}
|
||||
|
||||
public delegate void DebugPrinter(string msg, params Object[] parm);
|
||||
public static void PrintCallStack(DebugPrinter printer)
|
||||
{
|
||||
StackTrace stackTrace = new StackTrace(true); // get call stack
|
||||
StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames)
|
||||
|
@ -1862,7 +1868,7 @@ namespace OpenSim.Framework
|
|||
foreach (StackFrame stackFrame in stackFrames)
|
||||
{
|
||||
MethodBase mb = stackFrame.GetMethod();
|
||||
m_log.DebugFormat("{0}.{1}:{2}", mb.DeclaringType, mb.Name, stackFrame.GetFileLineNumber()); // write method name
|
||||
printer("{0}.{1}:{2}", mb.DeclaringType, mb.Name, stackFrame.GetFileLineNumber()); // write method name
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue