summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib/tpb_thread_body.cc
diff options
context:
space:
mode:
authorTom Rondeau <tom@trondeau.com>2014-02-16 14:26:14 -0500
committerTom Rondeau <tom@trondeau.com>2014-02-16 14:26:14 -0500
commitabdc4fcb6cade9442aceb36e5ec7e0c93210b9f1 (patch)
treeb22fc4d25863737844b850ae446c8727d6eb63b7 /gnuradio-runtime/lib/tpb_thread_body.cc
parenta7c7324edfa4e04cfc9415d53081367780ba92d9 (diff)
logger: setup logger for the tpb scheduler; fixes a swig issue when logger is not present.
Diffstat (limited to 'gnuradio-runtime/lib/tpb_thread_body.cc')
-rw-r--r--gnuradio-runtime/lib/tpb_thread_body.cc29
1 files changed, 27 insertions, 2 deletions
diff --git a/gnuradio-runtime/lib/tpb_thread_body.cc b/gnuradio-runtime/lib/tpb_thread_body.cc
index ea5d80a9dc..233bbda9e7 100644
--- a/gnuradio-runtime/lib/tpb_thread_body.cc
+++ b/gnuradio-runtime/lib/tpb_thread_body.cc
@@ -47,6 +47,31 @@ namespace gr {
prefs *p = prefs::singleton();
size_t max_nmsgs = static_cast<size_t>(p->get_long("DEFAULT", "max_messages", 100));
+ // Setup the logger for the scheduler
+#ifdef ENABLE_GR_LOG
+#ifdef HAVE_LOG4CPP
+ #undef LOG
+ std::string config_file = p->get_string("LOG", "log_config", "");
+ std::string log_level = p->get_string("LOG", "log_level", "");
+ std::string log_file = p->get_string("LOG", "log_file", "");
+ GR_LOG_GETLOGGER(LOG, "gr_log.tpb_thread_body");
+ GR_LOG_SET_LEVEL(LOG, log_level);
+ GR_CONFIG_LOGGER(config_file);
+ if(log_file.size() > 0) {
+ if(log_file == "stdout") {
+ GR_LOG_ADD_CONSOLE_APPENDER(LOG, "cout","gr::log :%p: %c{1} - %m%n");
+ }
+ else if(log_file == "stderr") {
+ GR_LOG_ADD_CONSOLE_APPENDER(LOG, "cerr","gr::log :%p: %c{1} - %m%n");
+ }
+ else {
+ GR_LOG_ADD_FILE_APPENDER(LOG, log_file , true,"%r :%p: %c{1} - %m%n");
+ }
+ }
+#endif /* HAVE_LOG4CPP */
+#endif /* ENABLE_GR_LOG */
+
+
// Set thread affinity if it was set before fg was started.
if(block->processor_affinity().size() > 0) {
gr::thread::thread_bind_to_processor(d->thread, block->processor_affinity());
@@ -119,7 +144,7 @@ namespace gr {
block->dispatch_msg(i.first, msg);
guard.lock();
}
- }
+ }
else {
// leave msg in queue if no handler is defined
// start dropping if we have too many
@@ -152,7 +177,7 @@ namespace gr {
block->dispatch_msg(i.first, msg);
guard.lock();
}
- }
+ }
else {
// leave msg in queue if no handler is defined
// start dropping if we have too many