Jump to content
  • Advertisement
Sign in to follow this  
Racky1275

[Solved] Logging with compiler generated constants

This topic is 3905 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've got a logging system where every time I log a message I want to say where in the code that message came from. Currently I have:
Log("gfxengine.c","Initalise","Failed to set screen resolution");


Which logs... "12/10/2007 10:33:12 - gfxengine.c(Initalise) - Failed to set screen resolution" It's quite tedious having to the tell the Log routine something which the compiler should already know, where in the code we currently are. Ideally I could just use something along the lines of:
Log(__File,__Procedure,"Failed to set screen resolution");


Where the compiler fills in the details automatically. Unfortunately I can't see anything in the VS Cpp Express 2005 documentation to suggest that this feature might exist. Anyone know??? [Edited by - Racky1275 on October 12, 2007 7:31:03 AM]

Share this post


Link to post
Share on other sites
Advertisement
There's always the __FILE__ and __LINE__ preprocessor macros (as well as __TIME__ and __DATE__). Some compilers have extensions for getting the function name as well.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!