PDA

View Full Version : Custom logging how to?



arcull
4th September 2015, 09:03
Hi. My desktop gui app needs some kind of logging functionality, so that some actions which were triggered by the user will log (probably to a file). I need then to display these logs in the same app in a simple tabelar view. How would you do this? Are there any existing components available for similar purpose? Thanks in advance.

anda_skoa
4th September 2015, 09:56
There are lots of logging frameworks available for C++.

Qt has one itself, though it does only have a subset of features, but the most common ones:
http://doc.qt.io/qt-5/qloggingcategory.html

I think it currenty can't log to a file itself, so one needs to install a Qt message handler to intercept the messages and write them to a file instead of stderr.

If your view doesn't need to be updated on-the-fly I would simply load and display the log file.
If it needs to, you probably need something more sophisticated.

Cheers,
_

arcull
4th September 2015, 10:41
Thanks, will take a look.