Porting notice: kDebug and qDebug need to go to qCDebug.

David Faure faure at kde.org
Wed Oct 16 14:55:18 UTC 2013


On Wednesday 16 October 2013 15:08:53 Mark wrote:
> On Wed, Oct 16, 2013 at 2:39 PM, David Faure <faure at kde.org> wrote:
> > On Tuesday 15 October 2013 21:58:51 Mark wrote:
> >> Also, by default when porting to a qCDebug line with a category you
> >> won't see log output because custom categories have everything
> >> disabled by default.
> > 
> > This has just been fixed in Qt, though.
> > 
> >     https://codereview.qt-project.org/66744
> 
> Oh interesting!
> Does that also mean that the porting notes should change from:
> qCDebug(CAT) << "some debug line";
> 
> to
> // qCDebug(CAT) << "some debug line";
> 
> (so commented) since now the default behavior is the same as qDebug()
> only with the category prefixed.

Well, on the other hand the default behavior is now the same as kDebug(area), 
for most values of area: it prints by default, but it can be turned off.

So qCDebug(CAT) << "some debug line"; seems fine to me. It's the whole purpose 
of this stuff.

> Or (the other option) should people now by default add a line to
> disable the category logging thus adding this line:
> QLoggingCategory::setFilterRules(QStringLiteral("category.debug = false"));

Please don't do that, it will prevent any better solution from working...
The better solution is for qt to read a config file on startup, and if that 
doesn't go in, for our qpa theme plugin to do that. Calling setFilterRules 
from apps leaves no control to the poor user.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5



More information about the Kde-frameworks-devel mailing list