On 5 September 2015 at 13:41, Boudewijn Rempt <b...@valdyas.org> wrote: > There is one more thing about logging using qCDebug and friends: > the logging categories are supposed to be defined _per library_. > > Which is actually pretty useless and not really how we've been > using categories in Calligra. Logging categories for file > handling, resource management or plugin handling that can be used > across libraries and applications make it possible to focus on > debugging a path through the application's execution. > > I don't debug pigment, I debug color management, for instance, which > is present in pigment, the colorspace plugin and parts of Krita. > > That's why for Krita, I made a generic debug interface in a little > global library that knows about all the categories and that can > be used from everywhere.
Yeah that's OK too, case by case. Names for these cross-libs categories can be invented too. Similarly, for database-reladed stuff we even have a GUI logger: http://i.imgur.com/9bfljqF.png > Oe Sat, 5 Sep 2015, Jaroslaw Staniek wrote: > >> Hi, >> This is a proposal for some consistency for naming of debug functions, >> debug headers and logging categories. >> I'll be trying to achieve in code I maintain. I can put some >> guidelines on the dev wiki. >> >> Details: >> After looking at recent commits such as Friedrich's 1dddbcdbceab0 >> "kWarning -> warnPigment" I was wondering if we want to have standards >> for debug handling. >> I don't use one in Kexi, not yet, but use one in >> kdb/kreport/kproperty. With increasing modularity it's quite important >> for our debugging needs to have logging categories. >> >> A scheme could be like >> {libnamelowercase}{Debug|Warning|Critical}() >> >> e.g. I use kdbDebug() << ... ; >> >> Note, for clarity () is used here too like in qDebug(). >> See kdb_debug.h >> https://quickgit.kde.org/?p=kdb.git&a=blob&f=src%2Fkdb_debug.h >> >> Furthermore, in kde_debug.cpp >> [https://quickgit.kde.org/?p=kdb.git&a=blob&f=src%2Fkdb_debug.cpp] I >> have: >> Q_LOGGING_CATEGORY(KDB_LOG, "org.kde.kdb.core") >> >> Note that you can pick your scheme for string, e.g. >> org.kde.calligra.{someapp} or org.calligra.{someapp} >> and for libs org.kde.{somelib}. It's important to have it unique and >> relatively short. Planning for future expansion is a good way too. >> >> For tests and example apps it may be enough to use default debug or >> for big code decide to add special category too. >> >> I also propose to use a libname prefix for the header name. This is >> what many bits in KF5 do. So we won't have to deal with dozens files >> prefixed with "Debug" soon (so libpigment's DebugPigment.h could >> become PigmentDebug.h or pigment_debug.h). >> >> PS: I am aware e.g. KF5 has various approaches there, use qDebug() >> with no categories, use qCDebug without defines. >> We have not fully migrated to logging categories in apps and internal >> libs so I thought it may be cool to think about consistency early >> enough. >> >> -- >> regards, Jaroslaw Staniek >> >> KDE: >> : A world-wide network of software engineers, artists, writers, >> translators >> : and facilitators committed to Free Software development - http://kde.org >> Calligra Suite: >> : A graphic art and office suite - http://calligra.org >> Kexi: >> : A visual database apps builder - http://calligra.org/kexi >> Qt Certified Specialist: >> : http://www.linkedin.com/in/jstaniek >> _______________________________________________ >> calligra-devel mailing list >> calligra-devel@kde.org >> https://mail.kde.org/mailman/listinfo/calligra-devel > > _______________________________________________ > calligra-devel mailing list > calligra-devel@kde.org > https://mail.kde.org/mailman/listinfo/calligra-devel -- regards, Jaroslaw Staniek KDE: : A world-wide network of software engineers, artists, writers, translators : and facilitators committed to Free Software development - http://kde.org Calligra Suite: : A graphic art and office suite - http://calligra.org Kexi: : A visual database apps builder - http://calligra.org/kexi Qt Certified Specialist: : http://www.linkedin.com/in/jstaniek _______________________________________________ calligra-devel mailing list calligra-devel@kde.org https://mail.kde.org/mailman/listinfo/calligra-devel