diff options
author | Nathan West <nathan.west@okstate.edu> | 2016-04-27 02:29:43 -0400 |
---|---|---|
committer | Nathan West <nathan.west@gnuradio.org> | 2016-08-04 11:37:42 -0400 |
commit | c8ffbf08723f10a2455d3de9e04f8a94bbf70c15 (patch) | |
tree | 48d352d37fa47e7df39cabf910cf85f501d6c88b | |
parent | 2e74eeffaf63ff7d67e813e937a0e10038fe49ac (diff) |
runtime: expose set_log_level for hier_blocks
-rw-r--r-- | gnuradio-runtime/include/gnuradio/basic_block.h | 3 | ||||
-rw-r--r-- | gnuradio-runtime/include/gnuradio/hier_block2.h | 20 | ||||
-rw-r--r-- | gnuradio-runtime/lib/hier_block2.cc | 6 | ||||
-rw-r--r-- | gnuradio-runtime/lib/hier_block2_detail.cc | 10 | ||||
-rw-r--r-- | gnuradio-runtime/lib/hier_block2_detail.h | 2 | ||||
-rw-r--r-- | gnuradio-runtime/swig/hier_block2.i | 2 |
6 files changed, 43 insertions, 0 deletions
diff --git a/gnuradio-runtime/include/gnuradio/basic_block.h b/gnuradio-runtime/include/gnuradio/basic_block.h index fa454c95ed..6e9b1fff3b 100644 --- a/gnuradio-runtime/include/gnuradio/basic_block.h +++ b/gnuradio-runtime/include/gnuradio/basic_block.h @@ -377,6 +377,9 @@ namespace gr { virtual std::vector<int> processor_affinity() { throw std::runtime_error("processor_affinity not overloaded in child class."); } + + virtual void set_log_level(std::string level) + { throw std::runtime_error("set_log_level not overloaded in child class."); } }; inline bool operator<(basic_block_sptr lhs, basic_block_sptr rhs) diff --git a/gnuradio-runtime/include/gnuradio/hier_block2.h b/gnuradio-runtime/include/gnuradio/hier_block2.h index 08a5389e96..6666906bfc 100644 --- a/gnuradio-runtime/include/gnuradio/hier_block2.h +++ b/gnuradio-runtime/include/gnuradio/hier_block2.h @@ -267,6 +267,26 @@ namespace gr { std::vector<int> processor_affinity(); /*! + * \brief Set the logger's output level. + * + * Sets the level of the logger for all connected blocks. This takes + * a string that is translated to the standard levels and can be + * (case insensitive): + * + * \li off , notset + * \li debug + * \li info + * \li notice + * \li warn + * \li error + * \li crit + * \li alert + * \li fatal + * \li emerg + */ + void set_log_level(std::string level); + + /*! * \brief Get if all block min buffers should be set. * * \details this returns whether all the block min output buffers diff --git a/gnuradio-runtime/lib/hier_block2.cc b/gnuradio-runtime/lib/hier_block2.cc index 597ae032ec..c9798c4324 100644 --- a/gnuradio-runtime/lib/hier_block2.cc +++ b/gnuradio-runtime/lib/hier_block2.cc @@ -178,6 +178,12 @@ namespace gr { return d_detail->processor_affinity(); } + void + hier_block2::set_log_level(std::string level) + { + d_detail->set_log_level(level); + } + std::string dot_graph(hier_block2_sptr hierblock2) { diff --git a/gnuradio-runtime/lib/hier_block2_detail.cc b/gnuradio-runtime/lib/hier_block2_detail.cc index 0d0ddf55ba..93fc67de32 100644 --- a/gnuradio-runtime/lib/hier_block2_detail.cc +++ b/gnuradio-runtime/lib/hier_block2_detail.cc @@ -956,4 +956,14 @@ namespace gr { return tmp[0]->processor_affinity(); } + void + hier_block2_detail::set_log_level(std::string level) + { + basic_block_vector_t tmp = d_fg->calc_used_blocks(); + for(basic_block_viter_t p = tmp.begin(); p != tmp.end(); p++) { + (*p)->set_log_level(level); + } + } + + } /* namespace gr */ diff --git a/gnuradio-runtime/lib/hier_block2_detail.h b/gnuradio-runtime/lib/hier_block2_detail.h index a5584fe92a..0298d392d5 100644 --- a/gnuradio-runtime/lib/hier_block2_detail.h +++ b/gnuradio-runtime/lib/hier_block2_detail.h @@ -57,6 +57,8 @@ namespace gr { void set_processor_affinity(const std::vector<int> &mask); void unset_processor_affinity(); std::vector<int> processor_affinity(); + + void set_log_level(std::string level); // Track output buffer min/max settings std::vector<size_t> d_max_output_buffer; diff --git a/gnuradio-runtime/swig/hier_block2.i b/gnuradio-runtime/swig/hier_block2.i index 12190d0452..4bf283965c 100644 --- a/gnuradio-runtime/swig/hier_block2.i +++ b/gnuradio-runtime/swig/hier_block2.i @@ -91,6 +91,8 @@ namespace gr { void unset_processor_affinity(); std::vector<int> processor_affinity(); + void set_log_level(std::string level); + // Methods to manage block's min/max buffer sizes. size_t max_output_buffer(int i); void set_max_output_buffer(size_t max_output_buffer); |