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 774976 - Set G_LOG_DOMAIN to "GEGL" only
Set G_LOG_DOMAIN to "GEGL" only
Status: RESOLVED FIXED
Product: GEGL
Classification: Other
Component: general
git master
Other Linux
: Normal normal
: 0.3.0
Assigned To: Default Gegl Component Owner
Default Gegl Component Owner
Depends on:
Blocks:
 
 
Reported: 2016-11-24 00:45 UTC by Jehan
Modified: 2016-11-24 22:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
configure: set G_LOG_DOMAIN to "GEGL" only. (870 bytes, patch)
2016-11-24 00:45 UTC, Jehan
none Details | Review

Description Jehan 2016-11-24 00:45:45 UTC
Created attachment 340657 [details] [review]
configure: set G_LOG_DOMAIN to "GEGL" only.

For bug 774971, we'd need to set a log handler to the error log domain. But configure sets G_LOG_DOMAIN to GEGL-__FILE__. That means every file has its own domain, but worse that it's impossible to actually hook to the domain because __FILE__ expands to a full path.

Here is for instance a warning message on my machine:

> GEGL-/home/jehan/dev/src/gegl/gegl/buffer/gegl-tile-backend-swap.c-Message: unable to write tile data to self: No space left on device (-1/65536 bytes written)

Note the log domain with huge path in it?

If we really want to have several log domain, maybe they should be set differently, but I think one single domain is just as simple.
Additionally if the need is additional information on where the error occurred, you may use G_STRFUNC inside the string error message.

Attached a patch which does the simple change to just "GEGL".
Comment 1 Jehan 2016-11-24 00:48:35 UTC
P.S.: the need is to be able to use g_log_set_handler() for instance to catch any GEGL message by its domain name.

https://developer.gnome.org/glib/stable/glib-Message-Logging.html#g-log-set-handler
Comment 2 Jehan 2016-11-24 01:07:27 UTC
Accepted by pippin on IRC.

commit fcc0bb57518d06ae22b7a8c8c8cd20e29c5e9649
Author: Jehan <jehan@girinstud.io>
Date:   Thu Nov 24 01:34:05 2016 +0100

    configure: set G_LOG_DOMAIN to "GEGL" only.
    
    Concatenating __FILE__ is a bad idea because it expands to a full path,
    which means the log domain ends up different on every machine depending
    on build path. This makes it impossible to set GEGL handlers in a
    generic way.

 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 3 Jehan 2016-11-24 14:26:47 UTC
Wait… did I put this really in GIMP with milestone 3.0 instead of GEGL 0.3? Waw. I was really not clear in my head yesterday!
Comment 4 Jehan 2016-11-24 22:38:32 UTC
Actually Pippin, would you prefer per-section domains additionally to a globale domain?

For instance, GIMP defines "Gimp-Actions" for all errors/warnings outputted under app/actions/, and similarly "Gimp-Core", "Gimp-Config" and so on. It also has a just "Gimp" domain for the rest.

I guess GEGL could (should?) have "GEGL-buffer", "GEGL-operation", and so on as well. If that's ok with you, I'll update the Makefile.am-s this way.
Comment 5 Jehan 2016-11-24 22:48:07 UTC
Well thinking twice, not so sure that's a great idea actually. Having many domains in a library forces the calling program to keep an updated list of the available domains and to set a handler on each of them.

It's better to have a single domain and simply handle various log levels differently. I'll just close back.