CuteLogger iostream confusion [Solved]
-
Hi, is anyone using CuteLogger?
I've got a problem/confusion with it and I can't find anywhere else to ask a question.
If I use a embedded text line:
LOG_INFO("Starting the application");
everything is output in the way that I would expect. If I us an iostream with just a quoted string the output is as I would expect:
LOG_INFO() << "Starting the application";
But if I use a QString to output the text:
LOG_INFO() << QString("Power On");
I get the quotes included in the output:
"Power On"
instead of:
Power OnDoes anyone have any experience with this or any insight into what is going on? I've tried these combinations with a QTextStream(stdout) iostream and I don't get the quotes so it appears to be something involving the CuteLogger, but I'm not enough of a C++ guru to know what might be happening.
-
Hi,
It's the normal behavior of QString when streamed to through qDebug, it outputs its content quoted.
IIRC, there was something about a newly added option for that during the Categorized Logging presentation but I can't remember exactly how. Need to wait for the presentation to be published :)
-
I'm using this under Qt 4.8 so I guess that means that I will just have to live with it for now.
Thanks for the update.
-
You can surround your QString with qPrintable like this:
@qDebug() << qPrintable(QString("Test"));@
-
Thank you, that seems to do exactly what I need.
-
You're welcome !
Since have pretty printing now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)