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

Dmitry Valento va.dimon at tut.by
Thu Feb 23 12:12:20 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
Thank you, Tim!

Now all is clear.


More information about the gstreamer-devel mailing list