How to write logs into files?
-
I'm not sure what console.log is, but the following works:
@
QFile myFile(...);
myFile.open(QIoDevice::WriteOnly);
QTextStream myLog(&myFile);
myLog << "Log message" << endl;
@ -
unclewerner, your solution is pure C++, not QML :)
You can overwrite debug ouput handler (in C++) to write in file and use QML console.log as you use it now and all messages will go to file.
-
Hi,
As the above comments indicate, there is no "pure-QML" solution to this problem -- you'll need to do some C++ coding in order to write to a file. This could be done by overriding the message handlers, or exposing you own custom function to QML that takes care of the writing. "This page":http://doc.qt.nokia.com/4.7-snapshot/qtbinding.html#exchanging-data-between-qml-and-c gives more information on some of the ways to communicate between C++ and QML.
Regards,
Michael