Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Simple Trace Format Tips

0.00/5 (No votes)
4 Oct 2000 1  
A simple way to format your TRACE statements so double clicking takes you directly to the source code

Introduction

When writing TRACE statements to the output window in DevStudio, it is often useful to be able to go directly to the section of code that produced the TRACE output. Doing this is simple - you just use the __FILE__ and __LINE__ macros in your TRACE statements.

If you format your TRACE statement as follows:

TRACE(_T("%s(%i) : Please double click on me!\n"), __FILE__,__LINE__);

then you can double click on the TRACE output line and be taken directly to the line of code the produced the TRACE statement.

An example of using this can be found in the enclosed example. Note that in the example, I used the CDuration class by Laurent Guinnard.

License

This article has no explicit license attached to it, but may contain usage terms in the article text or the download files themselves. If in doubt, please contact the author via the discussion board below.

A list of licenses authors might use can be found here.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here