I have a problem with QLoggingCategory(const char * category)
.
When I use it like:
QString rt = "3";
QString sv = "P";
QLoggingCategory dailyLogger(QString(rt+sv+"Logger").toStdString().c_str());
it doesn't work (my custom message handler doesn't recognize this category).
But when I use:
QLoggingCategory dailyLogger("3PLogger");
message handler sees the category.
Here's the handler function:
void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
if (QString(context.category).contains("3"))
{
//some code
}
}
Why does my computed category name not work?