summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/doxygen/other/main_page.dox2
-rw-r--r--gnuradio-core/CMakeLists.txt16
-rw-r--r--gnuradio-core/gnuradio-core.conf.in (renamed from gnuradio-core/gnuradio-core.conf)7
-rw-r--r--gnuradio-core/gr_log_default.xml (renamed from gnuradio-core/src/lib/runtime/gr_log_default.xml)0
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc91
-rw-r--r--gnuradio-core/src/lib/runtime/CMakeLists.txt8
-rw-r--r--gnuradio-core/src/lib/runtime/gr_log.cc13
-rw-r--r--gnuradio-core/src/lib/runtime/gr_log.h23
8 files changed, 103 insertions, 57 deletions
diff --git a/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox
index 8f47ed0d74..ec8642de66 100644
--- a/docs/doxygen/other/main_page.dox
+++ b/docs/doxygen/other/main_page.dox
@@ -86,7 +86,7 @@ default configuration script is located at:
In a class, we must first configure the logger and then get access to it:
\code
- GR_CONFIG_LOGGER("prefix/share/gnuradio/gr_log_default.xml");
+ GR_CONFIG_LOGGER("prefix/etc/gnuradio/conf.d/gr_log_default.xml");
GR_LOG_GETLOGGER(LOG, name);
\endcode
diff --git a/gnuradio-core/CMakeLists.txt b/gnuradio-core/CMakeLists.txt
index 0227108446..9ff7ed0a04 100644
--- a/gnuradio-core/CMakeLists.txt
+++ b/gnuradio-core/CMakeLists.txt
@@ -107,12 +107,26 @@ CPACK_COMPONENT("core_swig"
DEPENDS "gruel_swig;core_python;core_devel"
)
+# Setup configure file
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-core.conf.in
+ ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-core.conf
+@ONLY)
+
install(
- FILES gnuradio-core.conf
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-core.conf
DESTINATION ${GR_PKG_CONF_DIR}
COMPONENT "core_runtime"
)
+if(ENABLE_GR_LOG)
+install(FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_log_default.xml
+ DESTINATION ${GR_CONF_DIR}/gnuradio
+ COMPONENT "core_runtime"
+)
+endif(ENABLE_GR_LOG)
+
########################################################################
# Add subdirectories
########################################################################
diff --git a/gnuradio-core/gnuradio-core.conf b/gnuradio-core/gnuradio-core.conf.in
index 178b288e8d..dad07cd245 100644
--- a/gnuradio-core/gnuradio-core.conf
+++ b/gnuradio-core/gnuradio-core.conf.in
@@ -5,3 +5,10 @@
[DEFAULT]
verbose = False
+
+
+[LOG]
+
+log_config = @CMAKE_INSTALL_PREFIX@/etc/gnuradio/gr_log_default.xml
+log_level = all
+debug_level = DEBUG
diff --git a/gnuradio-core/src/lib/runtime/gr_log_default.xml b/gnuradio-core/gr_log_default.xml
index be721bb021..be721bb021 100644
--- a/gnuradio-core/src/lib/runtime/gr_log_default.xml
+++ b/gnuradio-core/gr_log_default.xml
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 97b8106994..4e3598c5d4 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,8 @@
// #include <gr_fir_sss_mmx.h>
// #include <gr_fir_sss_sse2.h>
-#include <iostream>
-using std::cerr;
+#include <gr_prefs.h>
+#include <gr_log.h>
/*
* ----------------------------------------------------------------
@@ -177,9 +177,13 @@ gr_fir_sysconfig_x86::create_gr_fir_ccf (const std::vector<float> &taps)
{
static bool first = true;
+ std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+ GR_CONFIG_LOGGER(log_file);
+ GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
+
if (gr_cpu::has_3dnow ()){
if (first){
- cerr << ">>> gr_fir_ccf: using 3DNow!\n";
+ GR_LOG_TRACE(LOG, "gr_fir_ccf: using 3DNow!");
first = false;
}
return make_gr_fir_ccf_3dnow (taps);
@@ -187,14 +191,14 @@ gr_fir_sysconfig_x86::create_gr_fir_ccf (const std::vector<float> &taps)
if (gr_cpu::has_sse ()){
if (first){
- cerr << ">>> gr_fir_ccf: using SSE\n";
+ GR_LOG_TRACE(LOG, "gr_fir_ccf: using SSE");
first = false;
}
return make_gr_fir_ccf_sse (taps);
}
if (first){
- cerr << ">>> gr_fir_ccf: handing off to parent class\n";
+ GR_LOG_TRACE(LOG, "gr_fir_ccf: handing off to parent class");
first = false;
}
return gr_fir_sysconfig_generic::create_gr_fir_ccf (taps);
@@ -205,9 +209,13 @@ gr_fir_sysconfig_x86::create_gr_fir_fcc (const std::vector<gr_complex> &taps)
{
static bool first = true;
+ std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+ GR_CONFIG_LOGGER(log_file);
+ GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
+
if (gr_cpu::has_3dnow ()){
if (first){
- cerr << ">>> gr_fir_fcc: using 3DNow!\n";
+ GR_LOG_TRACE(LOG, "gr_fir_fcc: gr_fir_fcc: using 3DNow!");
first = false;
}
return make_gr_fir_fcc_3dnow (taps);
@@ -215,14 +223,14 @@ gr_fir_sysconfig_x86::create_gr_fir_fcc (const std::vector<gr_complex> &taps)
if (gr_cpu::has_sse ()){
if (first){
- cerr << ">>> gr_fir_fcc: using SSE\n";
+ GR_LOG_TRACE(LOG, "gr_fir_fcc: gr_fir_fcc: using SSE");
first = false;
}
return make_gr_fir_fcc_sse (taps);
}
if (first){
- cerr << ">>> gr_fir_fcc: handing off to parent class\n";
+ GR_LOG_TRACE(LOG, "gr_fir_fcc: handing off to parent class");
first = false;
}
return gr_fir_sysconfig_generic::create_gr_fir_fcc (taps);
@@ -233,9 +241,13 @@ gr_fir_sysconfig_x86::create_gr_fir_ccc (const std::vector<gr_complex> &taps)
{
static bool first = true;
+ std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+ GR_CONFIG_LOGGER(log_file);
+ GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
+
if (gr_cpu::has_3dnowext ()){
if (first) {
- cerr << ">>> gr_fir_ccc: using 3DNow!Ext\n";
+ GR_LOG_TRACE(LOG, "gr_fir_ccc: using 3DNow!Ext");
first = false;
}
return make_gr_fir_ccc_3dnowext (taps);
@@ -243,7 +255,7 @@ gr_fir_sysconfig_x86::create_gr_fir_ccc (const std::vector<gr_complex> &taps)
if (gr_cpu::has_3dnow ()){
if (first) {
- cerr << ">>> gr_fir_ccc: using 3DNow!\n";
+ GR_LOG_TRACE(LOG, "gr_fir_ccc: using 3DNow!");
first = false;
}
return make_gr_fir_ccc_3dnow (taps);
@@ -251,14 +263,14 @@ gr_fir_sysconfig_x86::create_gr_fir_ccc (const std::vector<gr_complex> &taps)
if (gr_cpu::has_sse ()){
if (first){
- cerr << ">>> gr_fir_ccc: using SSE\n";
+ GR_LOG_TRACE(LOG, "gr_fir_ccc: using SSE");
first = false;
}
return make_gr_fir_ccc_sse (taps);
}
if (first){
- cerr << ">>> gr_fir_ccc: handing off to parent class\n";
+ GR_LOG_TRACE(LOG, "gr_fir_ccc: handing off to parent class");
first = false;
}
return gr_fir_sysconfig_generic::create_gr_fir_ccc (taps);
@@ -269,9 +281,13 @@ gr_fir_sysconfig_x86::create_gr_fir_fff (const std::vector<float> &taps)
{
static bool first = true;
+ std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+ GR_CONFIG_LOGGER(log_file);
+ GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
+
if (gr_cpu::has_3dnow ()){
if (first) {
- cerr << ">>> gr_fir_fff: using 3DNow!\n";
+ GR_LOG_TRACE(LOG, "gr_fir_fff: using 3DNow!");
first = false;
}
return make_gr_fir_fff_3dnow (taps);
@@ -279,14 +295,14 @@ gr_fir_sysconfig_x86::create_gr_fir_fff (const std::vector<float> &taps)
if (gr_cpu::has_sse ()){
if (first){
- cerr << ">>> gr_fir_fff: using SSE\n";
+ GR_LOG_TRACE(LOG, "gr_fir_fff: using SSE");
first = false;
}
return make_gr_fir_fff_sse (taps);
}
if (first){
- cerr << ">>> gr_fir_fff: handing off to parent class\n";
+ GR_LOG_TRACE(LOG, "gr_fir_fff: handing off to parent class");
first = false;
}
return gr_fir_sysconfig_generic::create_gr_fir_fff (taps);
@@ -297,9 +313,13 @@ gr_fir_sysconfig_x86::create_gr_fir_fsf (const std::vector<float> &taps)
{
static bool first = true;
+ std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+ GR_CONFIG_LOGGER(log_file);
+ GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
+
if (gr_cpu::has_3dnow ()){
if (first) {
- cerr << ">>> gr_fir_fsf: using 3DNow!\n";
+ GR_LOG_TRACE(LOG, "gr_fir_fsf: using 3DNow!");
first = false;
}
return make_gr_fir_fsf_3dnow (taps);
@@ -307,14 +327,14 @@ gr_fir_sysconfig_x86::create_gr_fir_fsf (const std::vector<float> &taps)
if (gr_cpu::has_sse ()){
if (first){
- cerr << ">>> gr_fir_fsf: using SSE\n";
+ GR_LOG_TRACE(LOG, "gr_fir_fsf: using SSE");
first = false;
}
return make_gr_fir_fsf_sse (taps);
}
if (first){
- cerr << ">>> gr_fir_fsf: handing off to parent class\n";
+ GR_LOG_TRACE(LOG, "gr_fir_fsf: handing off to parent class");
first = false;
}
return gr_fir_sysconfig_generic::create_gr_fir_fsf (taps);
@@ -326,19 +346,30 @@ gr_fir_sysconfig_x86::create_gr_fir_sss (const std::vector<short> &taps)
{
// FIXME -- probably want to figure out best answer for Athlon and code
// add code to select it here...
+ static bool first = true;
+
+ std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+ GR_CONFIG_LOGGER(log_file);
+ GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
if (gr_cpu::has_sse2 ()){
- cerr << ">>> gr_fir_sss: using SSE2\n";
- return make_gr_fir_sss_sse2 (taps);
+ if(first) {
+ GR_LOG_TRACE(LOG, "gr_fir_sss: using SSE2");
+ return make_gr_fir_sss_sse2 (taps);
+ }
}
if (gr_cpu::has_mmx ()){
- cerr << ">>> gr_fir_sss: using MMX\n";
- return make_gr_fir_sss_mmx (taps);
+ if(first) {
+ GR_LOG_TRACE(LOG, "gr_fir_sss: using MMX");
+ return make_gr_fir_sss_mmx (taps);
+ }
}
- cerr << ">>> gr_fir_sss: handing off to parent class\n";
- return gr_fir_sysconfig_generic::create_gr_fir_sss (taps);
+ if(first) {
+ GR_LOG_TRACE(LOG, "gr_fir_sss: handing off to parent class");
+ return gr_fir_sysconfig_generic::create_gr_fir_sss (taps);
+ }
}
#endif
@@ -347,9 +378,13 @@ gr_fir_sysconfig_x86::create_gr_fir_scc (const std::vector<gr_complex> &taps)
{
static bool first = true;
+ std::string log_file = gr_prefs::singleton()->get_string("LOG", "log_config", "");
+ GR_CONFIG_LOGGER(log_file);
+ GR_LOG_GETLOGGER(LOG, "gr_log.gr_fir_sysconfig_x86");
+
if (gr_cpu::has_3dnowext ()){
if (first){
- cerr << ">>> gr_fir_scc: using 3DNow!Ext\n";
+ GR_LOG_TRACE(LOG, "gr_fir_scc: using 3DNow!Ext");
first = false;
}
return make_gr_fir_scc_3dnowext (taps);
@@ -357,7 +392,7 @@ gr_fir_sysconfig_x86::create_gr_fir_scc (const std::vector<gr_complex> &taps)
if (gr_cpu::has_3dnow ()){
if (first){
- cerr << ">>> gr_fir_scc: using 3DNow!\n";
+ GR_LOG_TRACE(LOG, "gr_fir_scc: using 3DNow!");
first = false;
}
return make_gr_fir_scc_3dnow (taps);
@@ -365,14 +400,14 @@ gr_fir_sysconfig_x86::create_gr_fir_scc (const std::vector<gr_complex> &taps)
if (gr_cpu::has_sse ()){
if (first){
- cerr << ">>> gr_fir_scc: using SSE\n";
+ GR_LOG_TRACE(LOG, "gr_fir_scc: using SSE");
first = false;
}
return make_gr_fir_scc_sse (taps);
}
if (first){
- cerr << ">>> gr_fir_scc: handing off to parent class\n";
+ GR_LOG_TRACE(LOG, "gr_fir_scc: handing off to parent class");
first = false;
}
return gr_fir_sysconfig_generic::create_gr_fir_scc (taps);
diff --git a/gnuradio-core/src/lib/runtime/CMakeLists.txt b/gnuradio-core/src/lib/runtime/CMakeLists.txt
index e36e83e84f..b5fde7d03c 100644
--- a/gnuradio-core/src/lib/runtime/CMakeLists.txt
+++ b/gnuradio-core/src/lib/runtime/CMakeLists.txt
@@ -165,11 +165,3 @@ install(FILES
)
endif(ENABLE_PYTHON)
-
-if(ENABLE_GR_LOG)
-install(FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/gr_log_default.xml
- DESTINATION ${GR_PKG_DATA_DIR}
- COMPONENT "core_runtime"
-)
-endif(ENABLE_GR_LOG)
diff --git a/gnuradio-core/src/lib/runtime/gr_log.cc b/gnuradio-core/src/lib/runtime/gr_log.cc
index 5478bd70c0..7af55b155c 100644
--- a/gnuradio-core/src/lib/runtime/gr_log.cc
+++ b/gnuradio-core/src/lib/runtime/gr_log.cc
@@ -39,3 +39,16 @@
#include <gr_log.h>
+void
+logger_load_config(const std::string &config_filename)
+{
+ if(config_filename.size() == 0) {
+ BasicConfigurator::configure();
+ }
+ else if(config_filename.find(".xml") != std::string::npos) {
+ DOMConfigurator::configure(config_filename);
+ }
+ else {
+ PropertyConfigurator::configure(config_filename);
+ }
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_log.h b/gnuradio-core/src/lib/runtime/gr_log.h
index 4f718567df..9050b70eb3 100644
--- a/gnuradio-core/src/lib/runtime/gr_log.h
+++ b/gnuradio-core/src/lib/runtime/gr_log.h
@@ -46,6 +46,7 @@
#include <log4cxx/logger.h>
#include <log4cxx/logmanager.h>
+#include <log4cxx/basicconfigurator.h>
#include <log4cxx/xml/domconfigurator.h>
#include <log4cxx/propertyconfigurator.h>
@@ -135,16 +136,7 @@ using namespace log4cxx::helpers;
// Load configuration file
-void
-logger_load_config(std::string config_filename)
-{
- if(config_filename.find(".xml") != std::string::npos) {
- DOMConfigurator::configure(config_filename);
- }
- else {
- PropertyConfigurator::configure(config_filename);
- }
-}
+void logger_load_config(const std::string &config_filename="");
/*!
* \brief instantiate (configure) logger.
@@ -179,15 +171,8 @@ class gr_log
static LoggerPtr getLogger(std::string name)
{
- if(LogManager::exists(name)) {
- LoggerPtr logger = Logger::getLogger(name);
- return logger;
- }
- else {
- LoggerPtr logger = Logger::getLogger(name);
- logger->setLevel(log4cxx::Level::getOff());
- return logger;
- }
+ LoggerPtr logger = Logger::getLogger(name);
+ return logger;
};
// Wrappers for logging macros