PDA

View Full Version : How to do logging in a medium size Qt project



kumarkun
18th August 2010, 05:38
i am making a medium size Qt project having around 7 classes and there is a controller class and classes can communicate among themselves too.i want to add error logging feature in it also how can i achieve this.

i would like to mentio that i used qtinstallmessgehandler which to install logger method and its working fine.my main issue is the ideal location to instantiate the singleton logger class so that it is accessible throughout the project.

if anybody have any idea please do it asap

kunal :eek:

tbscope
18th August 2010, 05:53
Well, you have your message handler, why not use qDebug() << ... ?

In your message handler you can redirect your debug statements to a file, a socket, a tty, ...

Lykurg
18th August 2010, 07:29
my main issue is the ideal location to instantiate the singleton logger class so that it is accessible throughout the project.What pattern do you use? The good thing of singletons is that you can use them everywhere without initiate them. So I don't understand you problem. Have a look at the pattern at our wiki.