diff options
-rw-r--r-- | cmake/Modules/GrMiscUtils.cmake | 6 | ||||
-rw-r--r-- | gnuradio-core/CMakeLists.txt | 4 | ||||
-rw-r--r-- | gnuradio-core/gnuradio-core.conf.in | 2 | ||||
-rw-r--r-- | gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc | 9 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_block.cc | 4 | ||||
-rw-r--r-- | gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake | 41 |
6 files changed, 40 insertions, 26 deletions
diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake index 751aad5b4c..09270de67d 100644 --- a/cmake/Modules/GrMiscUtils.cmake +++ b/cmake/Modules/GrMiscUtils.cmake @@ -228,10 +228,10 @@ function(GR_LOGGING) # also test LOG4CXX; if we have it, use this version of the logger # otherwise, default to the stdout/stderr model. if(LOG4CXX_FOUND) - SET(HAVE_LOG4CXX True) + SET(HAVE_LOG4CXX True CACHE INTERNAL "" FORCE) add_definitions( -DHAVE_LOG4CXX ) else(LOG4CXX_FOUND) - SET(HAVE_LOG4CXX False) + SET(HAVE_LOG4CXX False CACHE INTERNAL "" FORCE) SET(LOG4CXX_INCLUDE_DIRS "") SET(LOG4CXX_LIBRARY_DIRS "") SET(LOG4CXX_LIBRARIES "") @@ -240,7 +240,7 @@ function(GR_LOGGING) SET(ENABLE_GR_LOG ${ENABLE_GR_LOG} CACHE INTERNAL "" FORCE) else(ENABLE_GR_LOG) - SET(HAVE_LOG4CXX False) + SET(HAVE_LOG4CXX False CACHE INTERNAL "" FORCE) SET(LOG4CXX_INCLUDE_DIRS) SET(LOG4CXX_LIBRARY_DIRS) SET(LOG4CXX_LIBRARIES) diff --git a/gnuradio-core/CMakeLists.txt b/gnuradio-core/CMakeLists.txt index 49484dfecc..1138bcc453 100644 --- a/gnuradio-core/CMakeLists.txt +++ b/gnuradio-core/CMakeLists.txt @@ -119,13 +119,13 @@ install( COMPONENT "core_runtime" ) -if(ENABLE_GR_LOG) +if(ENABLE_GR_LOG AND HAVE_LOG4CXX) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gr_log_default.xml DESTINATION ${GR_CONF_DIR}/gnuradio COMPONENT "core_runtime" ) -endif(ENABLE_GR_LOG) +endif(ENABLE_GR_LOG AND HAVE_LOG4CXX) ######################################################################## # Add subdirectories diff --git a/gnuradio-core/gnuradio-core.conf.in b/gnuradio-core/gnuradio-core.conf.in index 3e6db27a99..741525e642 100644 --- a/gnuradio-core/gnuradio-core.conf.in +++ b/gnuradio-core/gnuradio-core.conf.in @@ -6,6 +6,8 @@ verbose = False [LOG] +# Levels can be (case insensitive): +# trace, debug, info, warn, error, fatal log_level = all debug_level = all diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc index ab61806691..95e17123c8 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc +++ b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc @@ -48,8 +48,9 @@ // #include <gr_fir_sss_mmx.h> // #include <gr_fir_sss_sse2.h> -#include <gr_prefs.h> -#include <gr_logger.h> + +#include <iostream> +using std::cerr; /* * ---------------------------------------------------------------- @@ -187,14 +188,14 @@ gr_fir_sysconfig_x86::create_gr_fir_ccf (const std::vector<float> &taps) if (gr_cpu::has_sse ()){ if (first){ - cer << ">>> gr_fir_ccf: using SSE\n"; + cerr << ">>> gr_fir_ccf: using SSE\n"; first = false; } return make_gr_fir_ccf_sse (taps); } if (first){ - cer << ">>> gr_fir_ccf: handing off to parent class\n"; + cerr << ">>> gr_fir_ccf: handing off to parent class\n"; first = false; } return gr_fir_sysconfig_generic::create_gr_fir_ccf (taps); diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index 0dc9fe670d..6c2ec4c539 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -81,10 +81,10 @@ gr_block::gr_block (const std::string &name, GR_LOG_SET_LEVEL(DLOG, debug_level); if(debug_file.size() > 0) { if(debug_file == "stdout") { - GR_LOG_ADD_CONSOLE_APPENDER(DLOG, "gr::log :%p: %c{1} - %m%n", "System.out"); + GR_LOG_ADD_CONSOLE_APPENDER(DLOG, "gr::debug :%p: %c{1} - %m%n", "System.out"); } else if(debug_file == "stderr") { - GR_LOG_ADD_CONSOLE_APPENDER(DLOG, "gr::log :%p: %c{1} - %m%n", "System.err"); + GR_LOG_ADD_CONSOLE_APPENDER(DLOG, "gr::debug :%p: %c{1} - %m%n", "System.err"); } else { GR_LOG_ADD_FILE_APPENDER(DLOG, "%r :%p: %c{1} - %m%n", debug_file, ""); diff --git a/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake b/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake index cffe2f6540..685ac3c879 100644 --- a/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake +++ b/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake @@ -211,7 +211,7 @@ endfunction(GR_GEN_TARGET_DEPS) ######################################################################## -# Control use of gr_log +# Control use of gr_logger # Usage: # GR_LOGGING() # @@ -221,22 +221,33 @@ endfunction(GR_GEN_TARGET_DEPS) function(GR_LOGGING) find_package(Log4cxx) - OPTION(ENABLE_GR_LOG "Use gr_log" ON) - - if(NOT LOG4CXX_FOUND) - SET(ENABLE_GR_LOG OFF) - endif(NOT LOG4CXX_FOUND) - - message(STATUS "ENABLE_GR_LOG set to ${ENABLE_GR_LOG}.") - + OPTION(ENABLE_GR_LOG "Use gr_logger" ON) if(ENABLE_GR_LOG) + # If gr_logger is enabled, make it usable add_definitions( -DENABLE_GR_LOG ) + + # also test LOG4CXX; if we have it, use this version of the logger + # otherwise, default to the stdout/stderr model. + if(LOG4CXX_FOUND) + SET(HAVE_LOG4CXX True) + add_definitions( -DHAVE_LOG4CXX ) + else(LOG4CXX_FOUND) + SET(HAVE_LOG4CXX False) + SET(LOG4CXX_INCLUDE_DIRS "") + SET(LOG4CXX_LIBRARY_DIRS "") + SET(LOG4CXX_LIBRARIES "") + endif(LOG4CXX_FOUND) + + SET(ENABLE_GR_LOG ${ENABLE_GR_LOG} CACHE INTERNAL "" FORCE) + else(ENABLE_GR_LOG) - # If not enabled or available, set these variable to - # blank so we can use them later without having to - # check ENABLE_GR_LOG each time. - SET(LOG4CXX_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE) - SET(LOG4CXX_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE) - SET(LOG4CXX_LIBRARIES "" CACHE INTERNAL "" FORCE) + SET(HAVE_LOG4CXX False) + SET(LOG4CXX_INCLUDE_DIRS) + SET(LOG4CXX_LIBRARY_DIRS) + SET(LOG4CXX_LIBRARIES) endif(ENABLE_GR_LOG) + + message(STATUS "ENABLE_GR_LOG set to ${ENABLE_GR_LOG}.") + message(STATUS "HAVE_LOG4CXX set to ${HAVE_LOG4CXX}.") + endfunction(GR_LOGGING) |