GNOME Bugzilla – Bug 774976
Set G_LOG_DOMAIN to "GEGL" only
Last modified: 2016-11-24 22:48:07 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".
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
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(-)
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!
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.
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.