[USRP-users] UHD logging: Are errors not handled through std::clog the same way as infos are? Or: How to implement a custom logging facility when restricted to the UHD C API?

Janos Buttgereit janos.buttgereit at fh-muenster.de
Mon Mar 4 12:22:05 EST 2019


I’m using the UHD C API from within a C++ application. The reason for that is that UHD is optionally loaded as dynamic library at runtime through dlopen in case the user wants to use an ettus device and has the uhd library installed and therefore I’m limited to only use functions declared as extern C.

I need some custom logging facility for my application as it is GUI based, e.g. certain errors should end up in alert windows and not in console prints. However I haven’t found any possibility to implement such logging when restricted to the C API only. So first question: Did I overlook something? Any pointer on how to get custom logging working without using the C++ API would be greatly appreciated.

In the meantime I tried to go a different way. This document https://files.ettus.com/manual/page_logging.html <https://files.ettus.com/manual/page_logging.html> tells me, that UHD uses std::clog for everything using the console logging backend. As no other part of my application makes use of std::clog I simply redirected std::clog to a custom std::streambuf instance where I handle the log strings. This works quite well for the [INFO] log messages, however [ERROR] messages seem to bypass std::clog and are still printed to the console. Is this intended behaviour or a bug as the document tells that all console logging goes through std::clog?

Best regards
Janos Buttgereit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20190304/4884c3e5/attachment.html>

More information about the USRP-users mailing list