Geeks With Blogs
c pound I reject your reality and substitute my own!

Bloody useful, this code. Especially when threads or timers are involved.

 

class Tracer

{

      private Tracer() { }

 

      public static void WriteTracedDebugLine(string message)

      {

            StackTrace stack = new StackTrace();

            string caller = stack.GetFrame(2).GetMethod().Name;

            string callee = stack.GetFrame(1).GetMethod().Name;

 

            if(message != null && message.Length > 0)

                  Debug.WriteLine(message, caller + " -> " + callee);

            else

                  Debug.WriteLine(caller + " -> " + callee);

      }

}

Posted on Wednesday, August 23, 2006 12:35 PM | Back to top


Comments on this post: Traced Debug Line

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Dan Koster | Powered by: GeeksWithBlogs.net | Join free