c pound

I reject your reality and substitute my own!
posts - 46, comments - 37, trackbacks - 40

My Links

News

Archives

Image Galleries

Blog Communities

Blog is a stupid word

Lunch Hour

Resources

Traced Debug Line

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);

      }

}

Print | posted on Wednesday, August 23, 2006 12:35 PM |

Feedback

No comments posted yet.
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 

Powered by: