Why GStreamer's core is using GLib's log functions instead of its own?

Tim Müller tim at centricular.com
Thu Feb 23 12:08:19 UTC 2017


Hi,

> I needed to redirect ALL log messages to syslog. I created a function
> GstLogFunction and installed it with gst_debug_add_log_function.
> It was a little bit surprisingly, when some messages were printed to
> stderr anyway.

You'll also have to remove the default log handler of course.

> I've found out, that GLib's log functions (like g_warning,
> g_critical) are used in GStreamer's core (and in some plugins too)
> instead of GStreamer's functions (which are described in GstInfo).

These usually indicate programmer mistakes.

> Finally, it was managed to catch all messages:
> g_log_set_handler("GStreamer", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL |
> G_LOG_FLAG_RECURSION, syslog_handler, NULL);
> 
> "GStreamer" - is predefined log domain which is declared by variable
> g_log_domain_gstreamer in gst/gst.c
> 
> Could you, please, give me clarification about proper log message
> catching?

There's also g_set_print_handler() and g_set_printerr_handler() for
what it's worth.

Cheers
 -Tim
-- 
Tim Müller, Centricular Ltd - http://www.centricular.com


More information about the gstreamer-devel mailing list