Context
I'm writting a debug class in Qt for a project and I want to know in which class I am so now I write:
MyClass::function1()
{
DEBUG_IN("[MyClass] Enters function1()")
....do something
DEBUG_OUT("[MyClass] Exits function1()");
}
EDIT: DEBUG_IN()
and DEBUG_OUT()
are global functions. They are not part of the class MyClass
The question
Is it possible to get the name of the class where DEBUG() is called?
(and the bame of the function where DEBUG() is called?)
so that I could just do:
MyClass::function1()
{
DEBUG_IN("function1()")
....do something
DEBUG_OUT("function1()");
}
and
DEBUG_IN(QString text)
{
qDebug() << qPrintable("[")
<< qPrintable(getClassName())
<< qPrintable("] Enters ")
<< qPrintable(text);
}
Thx a lot