Dumping a thread like this is not nice, but while we are at it. For outputting, I like this better:
//in some basic header of your software.
#ifndef DEBUG_VERBOSITY
#define DEBUG_VERBOSITY 5
#endif
#define DEBUG_NOTICE(X,Y) if(X <= DEBUG_VERBOSITY) std::cout << __FILE__ << ":" << __LINE__ << " " << Y << std::endl;
//then in the code:
int main() {
//..do something, then output an important debug notice:
DEBUG_NOTICE(2,"the last operation failed! With error '" << error_message << "'")
//..do other stuff, then output a not-so-important debug notice:
DEBUG_NOTICE(8,"reached this point without segfault!");
... etc ...
};