[Development] QLog ( Work on qDebug and friends)
andre at familiesomers.nl
Thu Feb 2 12:52:38 CET 2012
Op 2-2-2012 0:03, BRM schreef:
>> From: David Faure<david.faure at kdab.com>
>> On Wednesday 01 February 2012 10:02:00 BRM wrote:
>>> I would also suggest that the plugins use a standard public interface class
>>> such as QAbstractLogFacility, like QTcpSocket uses QAbstractSocket - so
>>> that people can add their own custom logging output easily
>> This is already available, see qInstallMessageHandler in Qt 5
>> (qInstallMsgHandler in earlier versions)
> I am very aware of what is in Qt4 right now (http://doc.qt.nokia.com/5.0-snapshot/qtglobal.html#qInstallMsgHandler - and in Qt5 by extension)
> This functionality is very primitive when compared to other facilities like syslog or the Windows EventLog.
> It does the job for a very basic logging system, but when you need to start categorizing your log messagse it does not do well at all.
> I am talking about something that is far more comprehensive, which is also what I believe they were discussion with respect to what I replied to.
> Now, I think the existing qDebug() and friends are nice for built-in stuff and for doing some general easy apps; and they should certainly remain the default.
> However, we should also offer a more extensive logging system that can be used instead - which registers a message handler and takes over.
> Or what about when you want to record to multiple facilities? E.g. sending to syslog and your own file logging.
> (This is useful in distributed logging situations so that you can capture a local log and still send out to the distributed log as well.)
> I think Qt can offer a basic logging framework that can be optionally used by those that want to use it. It would make a nice Add-on module.
> And why force users to rewrite functionality for some of the most common logging systems (e.g. syslog and Windows EventLog)?
I think there are plenty of implementations doing this already. Take a
look at QxtLogger for instance. It can be used with the output handler
just fine, but it also allows more finegrained access with more than
four levels. It also supports multiple outputs.
I see no need to make all this part of Qt *now*, especially not of core.
The very existence of external libraries that integrate with the current
structure shows that it is exendable enough.
More information about the Development