admin管理员组文章数量:1023187
I have gstreamer pipelines running in my C++ application. To check problems relative to those, I enable printing debug information by setting the variable GST_DEBUG as explained on this page : .html?gi-language=c. However, this prints directly on cout and I use a logging library (log4cplus) in my application. As gstreamer debug information is divided in categories very similar to the ones in log4cplus (error, warn, debug, etc.), I expected it would be possible to redirect those messages in my logger but I cannot find any information on how to do it.
I used the Qt framework before, and it has a function 'qInstallMessageHandler' which enables redirecting qt logs to a custom logger. Does gstreamer have anything like that?
I have gstreamer pipelines running in my C++ application. To check problems relative to those, I enable printing debug information by setting the variable GST_DEBUG as explained on this page : https://gstreamer.freedesktop./documentation/tutorials/basic/debugging-tools.html?gi-language=c. However, this prints directly on cout and I use a logging library (log4cplus) in my application. As gstreamer debug information is divided in categories very similar to the ones in log4cplus (error, warn, debug, etc.), I expected it would be possible to redirect those messages in my logger but I cannot find any information on how to do it.
I used the Qt framework before, and it has a function 'qInstallMessageHandler' which enables redirecting qt logs to a custom logger. Does gstreamer have anything like that?
Share Improve this question asked Nov 19, 2024 at 8:45 NyacreepsNyacreeps 233 bronze badges1 Answer
Reset to default 0I have no experience with this but it looks like you can register a C function that will get called by the Gstreamer framework when it logs.
static void gst_log_handler(GstDebugCategory *category,
GstDebugLevel level, const gchar *file, const gchar *function,
gint line, GObject *object, GstDebugMessage *message, gpointer user_data) {
// Convert into log4cplus::spi::InternalLoggingEvent and log it.
}
// Somewhere else then register it:
gst_debug_add_log_function(debug_category, gst_log_handler, nullptr);
I have gstreamer pipelines running in my C++ application. To check problems relative to those, I enable printing debug information by setting the variable GST_DEBUG as explained on this page : .html?gi-language=c. However, this prints directly on cout and I use a logging library (log4cplus) in my application. As gstreamer debug information is divided in categories very similar to the ones in log4cplus (error, warn, debug, etc.), I expected it would be possible to redirect those messages in my logger but I cannot find any information on how to do it.
I used the Qt framework before, and it has a function 'qInstallMessageHandler' which enables redirecting qt logs to a custom logger. Does gstreamer have anything like that?
I have gstreamer pipelines running in my C++ application. To check problems relative to those, I enable printing debug information by setting the variable GST_DEBUG as explained on this page : https://gstreamer.freedesktop./documentation/tutorials/basic/debugging-tools.html?gi-language=c. However, this prints directly on cout and I use a logging library (log4cplus) in my application. As gstreamer debug information is divided in categories very similar to the ones in log4cplus (error, warn, debug, etc.), I expected it would be possible to redirect those messages in my logger but I cannot find any information on how to do it.
I used the Qt framework before, and it has a function 'qInstallMessageHandler' which enables redirecting qt logs to a custom logger. Does gstreamer have anything like that?
Share Improve this question asked Nov 19, 2024 at 8:45 NyacreepsNyacreeps 233 bronze badges1 Answer
Reset to default 0I have no experience with this but it looks like you can register a C function that will get called by the Gstreamer framework when it logs.
static void gst_log_handler(GstDebugCategory *category,
GstDebugLevel level, const gchar *file, const gchar *function,
gint line, GObject *object, GstDebugMessage *message, gpointer user_data) {
// Convert into log4cplus::spi::InternalLoggingEvent and log it.
}
// Somewhere else then register it:
gst_debug_add_log_function(debug_category, gst_log_handler, nullptr);
本文标签: cHow to redirect gstreamer debug information to a logging libraryStack Overflow
版权声明:本文标题:c++ - How to redirect gstreamer debug information to a logging library - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745572733a2156834.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论