From 0f88db1ef0569bf6fcd5e9c843da38d487a6f54b Mon Sep 17 00:00:00 2001 From: Marcus Müller <mmueller@gnuradio.org> Date: Sat, 11 Apr 2020 00:43:39 +0200 Subject: runtime: replace stderr logging by calls to GR's logging facilties --- gnuradio-runtime/lib/realtime_impl.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'gnuradio-runtime/lib/realtime_impl.cc') diff --git a/gnuradio-runtime/lib/realtime_impl.cc b/gnuradio-runtime/lib/realtime_impl.cc index 573e46e05b..24e9c0d034 100644 --- a/gnuradio-runtime/lib/realtime_impl.cc +++ b/gnuradio-runtime/lib/realtime_impl.cc @@ -12,6 +12,8 @@ #include <config.h> #endif +#include <gnuradio/logger.h> +#include <gnuradio/prefs.h> #include <gnuradio/realtime_impl.h> #ifdef HAVE_SCHED_H @@ -109,8 +111,12 @@ rt_status_t enable_realtime_scheduling(rt_sched_param p) if (result == EPERM) // N.B., return value, not errno return RT_NO_PRIVS; else { - fprintf(stderr, - "pthread_setschedparam: failed to set real time priority: %s\n", + gr::logger_ptr logger, debug_logger; + gr::configure_default_loggers(logger, debug_logger, "realtime_impl"); + GR_LOG_ERROR( + logger, + boost::format( + "pthread_setschedparam: failed to set real time priority: %s") % strerror(result)); return RT_OTHER_ERROR; } @@ -148,7 +154,11 @@ rt_status_t enable_realtime_scheduling(rt_sched_param p) if (errno == EPERM) return RT_NO_PRIVS; else { - perror("sched_setscheduler: failed to set real time priority"); + gr::logger_ptr logger, debug_logger; + gr::configure_default_loggers(logger, debug_logger, "realtime_impl"); + GR_LOG_ERROR( + logger, + boost::format("sched_setscheduler: failed to set real time priority.")); return RT_OTHER_ERROR; } } -- cgit v1.2.3