After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 785130 - G_LOG_DOMAIN shouldn't be left undefined for applications
G_LOG_DOMAIN shouldn't be left undefined for applications
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: docs
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2017-07-19 14:20 UTC by Debarshi Ray
Modified: 2017-07-20 17:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
docs: Encourage applications to define G_LOG_DOMAIN (1.24 KB, patch)
2017-07-20 16:57 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2017-07-19 14:20:12 UTC
The G_LOG_DOMAIN documentation [1] says:

"For applications, this is typically left as the default NULL (or "") domain. Libraries should define this so that any messages which they log can be differentiated from messages from other libraries and application code. But be careful not to define it in any public header files."

It seems wrong to suggest that applications shouldn't be setting a G_LOG_DOMAIN. For example, gnome-photos links against two libraries (gdk-pixbuf and tracker) that emit copious amounts of debug with G_MESSAGES_DEBUG=all. Often I am not interested in the spew from these libraries, but debug output coming from the application itself (plus WARNINGs and CRITICALs from everywhere). So, I need a way to filter out every log domain. It seems to me that the way to do that is to set G_MESSAGES_DEBUG=gnome-photos, but for that the app needs to set a domain.

The documentation elsewhere on that same page [1] also seems to suggest that apps should have their own domains.

Does this make sense?

[1] https://developer.gnome.org/glib/stable/glib-Message-Logging.html#G-LOG-DOMAIN:CAPS
Comment 1 Matthias Clasen 2017-07-20 12:13:02 UTC
Yes, this could be reworded. It should perhaps say that you _can_ leave G_LOG_DOMAIN empty, but that an advantage of not doing so is that you can filter debug messages with G_MESSAGES_DEBUG.
Comment 2 Debarshi Ray 2017-07-20 16:57:19 UTC
Created attachment 356059 [details] [review]
docs: Encourage applications to define G_LOG_DOMAIN
Comment 3 Matthias Clasen 2017-07-20 17:09:17 UTC
Review of attachment 356059 [details] [review]:

Looks good to me
Comment 4 Debarshi Ray 2017-07-20 17:45:21 UTC
Pushed to master.