Created
November 6, 2018 19:33
-
-
Save jflopezfernandez/896e2f61c36a908d7824b1a0fed08c91 to your computer and use it in GitHub Desktop.
MSVC - Print current function to log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// --------------------------------------------------------------------------------------------------------- | |
// | |
// Author: Jose Fernando Lopez Fernandez | |
// Date: 6-November-2018 | |
// | |
// Description: Logs the current function to std::clog. Simple inline function won't work for obvious reasons, | |
// so this is a workaround to not have to fire up the actual debugger and check the call stack. | |
// The function call format is for homogeneity in the code, while preventing confusion by explicitly | |
// including the fact that it is a macro in the name. | |
// | |
// Usage: | |
// void DoSomething() { | |
// LogFunctionNameMacro(); | |
// Do things... | |
// } | |
// | |
// Output: | |
// Calling function: DoSomething | |
// | |
// --------------------------------------------------------------------------------------------------------- | |
#define LogFunctionNameMacro() (std::clog << "Calling function: " << __FUNCTION__ << '\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment