J
Javier
Hi all,
thanks for the replies to my posts... Here is one more:
I have a debug-log macro in my code like the following:
--- important_things.h
[...]
#ifdef DEBUG
# ifndef _MSGDEBUG
# define _MSGDEBUG(text); std::cout << std::string(text) <<
std::endl;
# endif
#else
# ifndef _MSGDEBUG
# define _MSGDEBUG(text); /* Nothing */
# endif
#endif
#ifndef _MSGERROR
# define _MSGERROR(text); std::cerr << std::string(text) <<
std::endl;
#endif
[...]
--- myclass.cpp
#include "important_things.h"
[...]
void myclass::myfunc()
{
_MSGDEBUG("myclass::myfunc:: Doing anything important...");
[...]
_MSGERROR("myclass::myfunc:: Ohh no, error I want always to be
printed");
[...]
_MSJDEBUG("myclass::myfunc:: Done.");
}
Now my question is if there is a way of doing the output of
"myclass::myfunc" in an automated way, like if I used the __FILE__ and
__LINE__ (but I prefer the information about function and class to
file and line number).
Of course, if I have more nested ownership (sorry about my english),
it would be perfect that can automatically output
"myclass::mysubclass::myfunc" to avoid writting lot of text in the
calls to _MSGDEBUG() and MSGERROR().
I need it only for debug, but if there is a way of doing this, it
would be perfect to keep it in released bins without so much overload,
and do it with variables so I could activate/deactivate it at runtime
and not at compile time with preprocessor macros.
Thanks.
thanks for the replies to my posts... Here is one more:
I have a debug-log macro in my code like the following:
--- important_things.h
[...]
#ifdef DEBUG
# ifndef _MSGDEBUG
# define _MSGDEBUG(text); std::cout << std::string(text) <<
std::endl;
# endif
#else
# ifndef _MSGDEBUG
# define _MSGDEBUG(text); /* Nothing */
# endif
#endif
#ifndef _MSGERROR
# define _MSGERROR(text); std::cerr << std::string(text) <<
std::endl;
#endif
[...]
--- myclass.cpp
#include "important_things.h"
[...]
void myclass::myfunc()
{
_MSGDEBUG("myclass::myfunc:: Doing anything important...");
[...]
_MSGERROR("myclass::myfunc:: Ohh no, error I want always to be
printed");
[...]
_MSJDEBUG("myclass::myfunc:: Done.");
}
Now my question is if there is a way of doing the output of
"myclass::myfunc" in an automated way, like if I used the __FILE__ and
__LINE__ (but I prefer the information about function and class to
file and line number).
Of course, if I have more nested ownership (sorry about my english),
it would be perfect that can automatically output
"myclass::mysubclass::myfunc" to avoid writting lot of text in the
calls to _MSGDEBUG() and MSGERROR().
I need it only for debug, but if there is a way of doing this, it
would be perfect to keep it in released bins without so much overload,
and do it with variables so I could activate/deactivate it at runtime
and not at compile time with preprocessor macros.
Thanks.