[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 06/07: logger: poor placement of the functi
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 06/07: logger: poor placement of the function inside the ifdefs. Moving outside to make the function accessible with any logger setting. |
Date: |
Thu, 14 Aug 2014 15:23:30 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
trondeau pushed a commit to branch master
in repository gnuradio.
commit 7926c2b3928a24684863b6850e7e7d9737c912c5
Author: Tom Rondeau <address@hidden>
Date: Wed Aug 13 18:09:38 2014 -0400
logger: poor placement of the function inside the ifdefs. Moving outside to
make the function accessible with any logger setting.
---
gnuradio-runtime/lib/logger.cc | 115 +++++++++++++++++++++--------------------
1 file changed, 60 insertions(+), 55 deletions(-)
diff --git a/gnuradio-runtime/lib/logger.cc b/gnuradio-runtime/lib/logger.cc
index 961ba55..bb1d4b4 100644
--- a/gnuradio-runtime/lib/logger.cc
+++ b/gnuradio-runtime/lib/logger.cc
@@ -43,61 +43,6 @@ namespace gr {
bool logger_config::logger_configured(false);
-
- bool
- configure_default_loggers(gr::logger_ptr &l, gr::logger_ptr &d,
- const std::string name)
- {
-#ifdef ENABLE_GR_LOG
-#ifdef HAVE_LOG4CPP
- prefs *p = prefs::singleton();
- std::string config_file = p->get_string("LOG", "log_config", "");
- std::string log_level = p->get_string("LOG", "log_level", "off");
- std::string log_file = p->get_string("LOG", "log_file", "");
- std::string debug_level = p->get_string("LOG", "debug_level", "off");
- std::string debug_file = p->get_string("LOG", "debug_file", "");
-
- GR_CONFIG_LOGGER(config_file);
-
- GR_LOG_GETLOGGER(LOG, "gr_log." + name);
- GR_LOG_SET_LEVEL(LOG, log_level);
- if(log_file.size() > 0) {
- if(log_file == "stdout") {
- GR_LOG_SET_CONSOLE_APPENDER(LOG, "cout","gr::log :%p: %c{1} - %m%n");
- }
- else if(log_file == "stderr") {
- GR_LOG_SET_CONSOLE_APPENDER(LOG, "cerr","gr::log :%p: %c{1} - %m%n");
- }
- else {
- GR_LOG_SET_FILE_APPENDER(LOG, log_file , true,"%r :%p: %c{1} - %m%n");
- }
- }
- l = LOG;
-
- GR_LOG_GETLOGGER(DLOG, "gr_log_debug." + name);
- GR_LOG_SET_LEVEL(DLOG, debug_level);
- if(debug_file.size() > 0) {
- if(debug_file == "stdout") {
- GR_LOG_SET_CONSOLE_APPENDER(DLOG, "cout","gr::debug :%p: %c{1} -
%m%n");
- }
- else if(debug_file == "stderr") {
- GR_LOG_SET_CONSOLE_APPENDER(DLOG, "cerr", "gr::debug :%p: %c{1} -
%m%n");
- }
- else {
- GR_LOG_SET_FILE_APPENDER(DLOG, debug_file, true, "%r :%p: %c{1} -
%m%n");
- }
- }
- d = DLOG;
- return true;
-#endif /* HAVE_LOG4CPP */
-
-#else /* ENABLE_GR_LOG */
- l = NULL;
- d = NULL;
- return false;
-#endif /* ENABLE_GR_LOG */
- }
-
/************************ BEGIN LOG4CPP HELPERS ***********************/
/* Logger config class. This is a singleton that controls how
* log4cpp is configured If watch_period>0 a thread is started to
@@ -413,3 +358,63 @@ gr_logger_reset_config(void)
}
#endif /* ENABLE_GR_LOGGER */
+
+
+namespace gr {
+
+ bool
+ configure_default_loggers(gr::logger_ptr &l, gr::logger_ptr &d,
+ const std::string name)
+ {
+#ifdef ENABLE_GR_LOG
+#ifdef HAVE_LOG4CPP
+ prefs *p = prefs::singleton();
+ std::string config_file = p->get_string("LOG", "log_config", "");
+ std::string log_level = p->get_string("LOG", "log_level", "off");
+ std::string log_file = p->get_string("LOG", "log_file", "");
+ std::string debug_level = p->get_string("LOG", "debug_level", "off");
+ std::string debug_file = p->get_string("LOG", "debug_file", "");
+
+ GR_CONFIG_LOGGER(config_file);
+
+ GR_LOG_GETLOGGER(LOG, "gr_log." + name);
+ GR_LOG_SET_LEVEL(LOG, log_level);
+ if(log_file.size() > 0) {
+ if(log_file == "stdout") {
+ GR_LOG_SET_CONSOLE_APPENDER(LOG, "cout","gr::log :%p: %c{1} - %m%n");
+ }
+ else if(log_file == "stderr") {
+ GR_LOG_SET_CONSOLE_APPENDER(LOG, "cerr","gr::log :%p: %c{1} - %m%n");
+ }
+ else {
+ GR_LOG_SET_FILE_APPENDER(LOG, log_file , true,"%r :%p: %c{1} - %m%n");
+ }
+ }
+ l = LOG;
+
+ GR_LOG_GETLOGGER(DLOG, "gr_log_debug." + name);
+ GR_LOG_SET_LEVEL(DLOG, debug_level);
+ if(debug_file.size() > 0) {
+ if(debug_file == "stdout") {
+ GR_LOG_SET_CONSOLE_APPENDER(DLOG, "cout","gr::debug :%p: %c{1} -
%m%n");
+ }
+ else if(debug_file == "stderr") {
+ GR_LOG_SET_CONSOLE_APPENDER(DLOG, "cerr", "gr::debug :%p: %c{1} -
%m%n");
+ }
+ else {
+ GR_LOG_SET_FILE_APPENDER(DLOG, debug_file, true, "%r :%p: %c{1} -
%m%n");
+ }
+ }
+ d = DLOG;
+ return true;
+#endif /* HAVE_LOG4CPP */
+
+#else /* ENABLE_GR_LOG */
+ l = NULL;
+ d = NULL;
+ return false;
+#endif /* ENABLE_GR_LOG */
+ return false;
+ }
+
+} /* namespace gr */
- [Commit-gnuradio] [gnuradio] branch master updated (2e691d8 -> 842d8c9), git, 2014/08/14
- [Commit-gnuradio] [gnuradio] 01/07: logger: adding new configure_default_logger function to make it easier to get log file info on logger setup., git, 2014/08/14
- [Commit-gnuradio] [gnuradio] 05/07: Merge remote-tracking branch 'arya/audio_registration', git, 2014/08/14
- [Commit-gnuradio] [gnuradio] 02/07: cmake: adding a function to allow components to reference submodules for display., git, 2014/08/14
- [Commit-gnuradio] [gnuradio] 03/07: audio: modified the audio registration system., git, 2014/08/14
- [Commit-gnuradio] [gnuradio] 07/07: Merge branch 'maint', git, 2014/08/14
- [Commit-gnuradio] [gnuradio] 04/07: Merge branch 'maint', git, 2014/08/14
- [Commit-gnuradio] [gnuradio] 06/07: logger: poor placement of the function inside the ifdefs. Moving outside to make the function accessible with any logger setting.,
git <=