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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Dmitry Valento
Hello

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.
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).

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?
Why GStreamer's core is using GLib's log functions instead of its own?
Reply | Threaded
Open this post in threaded view
|

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

Tim Müller
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
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

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

Dmitry Valento

> 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.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel