GNOME Bugzilla – Bug 785130
G_LOG_DOMAIN shouldn't be left undefined for applications
Last modified: 2017-07-20 17:45:21 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
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.
Created attachment 356059 [details] [review] docs: Encourage applications to define G_LOG_DOMAIN
Review of attachment 356059 [details] [review]: Looks good to me
Pushed to master.