Date: Wednesday, December 27, 2006 @ 16:21:49
  Author: marc
    Path: /cvsroot/carob/carob

Modified: GNUmakefile (1.5 -> 1.6) src/Common.cpp (1.54 -> 1.55)
          test/CarobTestLauncher.cpp (1.39 -> 1.40)

-DCAROB_USE_LOG4CXX is replaced by -DCAROB_LOG4CXX_NAME=loggername


----------------------------+
 GNUmakefile                |    2 +-
 src/Common.cpp             |   34 +++++++++++++++-------------------
 test/CarobTestLauncher.cpp |    4 ++--
 3 files changed, 18 insertions(+), 22 deletions(-)


Index: carob/GNUmakefile
diff -u carob/GNUmakefile:1.5 carob/GNUmakefile:1.6
--- carob/GNUmakefile:1.5       Thu Dec 21 23:23:17 2006
+++ carob/GNUmakefile   Wed Dec 27 16:21:49 2006
@@ -90,7 +90,7 @@
 
 ARFLAGS                 = rcs
 # Uncomment these 2 lines to use log4cxx instead of internal logger
-#CXXFLAGS                += -DCAROB_USE_LOG4CXX
+#CXXFLAGS                += -DCAROB_LOG4CXX_NAME=CarobLogs
 #LDFLAGS                 += -llog4cxx
 
 #Doc
Index: carob/src/Common.cpp
diff -u carob/src/Common.cpp:1.54 carob/src/Common.cpp:1.55
--- carob/src/Common.cpp:1.54   Wed Dec 27 15:54:43 2006
+++ carob/src/Common.cpp        Wed Dec 27 16:21:49 2006
@@ -24,7 +24,7 @@
 #include "StringCodecs.hpp"
 
 //LOG4CXX includes
-#ifdef CAROB_USE_LOG4CXX
+#ifdef CAROB_LOG4CXX_NAME
 #include "StringCodecs.hpp" //for toString
 #include <log4cxx/logger.h>
 #endif
@@ -47,7 +47,7 @@
 #include <stdexcept>
 #include <locale>
 
-#if ! defined(CAROB_USE_LOG4CXX)
+#if ! defined(CAROB_LOG4CXX_NAME)
 namespace {
   /** The current log level (set by setLogLevel) */
   CarobNS::LogLevel currentLogLevel = CarobNS::LOG_LEVEL_WARN;
@@ -60,13 +60,9 @@
 using std::endl;
 
 
-#ifdef CAROB_USE_LOG4CXX
+#ifdef CAROB_LOG4CXX_NAME
 using namespace log4cxx;
 
-#ifndef CAROB_LOG4CXX_NAME
-#define CAROB_LOG4CXX_NAME Carob
-#endif
-
 // need two steps to delay expansion of argument
 #define STRINGIFY(x) #x
 #define TOSTRING(x) STRINGIFY(x)
@@ -82,7 +78,7 @@
   return logger;
 }
 }
-#endif //  CAROB_USE_LOG4CXX
+#endif //  CAROB_LOG4CXX_NAME
 
 
 // On linux or MACOSX>10.4 try "locale -a" to get the list of all available 
locales.
@@ -100,7 +96,7 @@
 
 void CarobNS::setLogLevel(const LogLevel l)
 {
-#ifdef CAROB_USE_LOG4CXX
+#ifdef CAROB_LOG4CXX_NAME
   if (l == LOG_LEVEL_DEBUG)
     logger->setLevel(log4cxx::Level::DEBUG);
   else if (l == LOG_LEVEL_INFO)
@@ -120,7 +116,7 @@
 
 void CarobNS::logDebug(const wstring& fctName, const wstring& s)
 {
-#ifdef CAROB_USE_LOG4CXX
+#ifdef CAROB_LOG4CXX_NAME
   // Log4cxx <= 0.9.7 doesn't accept wstrings - we have to convert the string
   LOG4CXX_DEBUG(logger, StaticCodecs::toString(fctName + L": " + s));
 #else
@@ -130,7 +126,7 @@
 }
 void CarobNS::logInfo(const wstring& fctName, const wstring& s)
 {
-#ifdef CAROB_USE_LOG4CXX
+#ifdef CAROB_LOG4CXX_NAME
   LOG4CXX_INFO(logger, StaticCodecs::toString(fctName + L": " + s));
 #else
   if (isInfoEnabled())
@@ -139,7 +135,7 @@
 }
 void CarobNS::logWarn(const wstring& fctName, const wstring& s)
 {
-#ifdef CAROB_USE_LOG4CXX
+#ifdef CAROB_LOG4CXX_NAME
   LOG4CXX_WARN(logger, StaticCodecs::toString(fctName + L": " + s));
 #else
   if (isWarnEnabled())
@@ -148,7 +144,7 @@
 }
 void CarobNS::logError(const wstring& fctName, const wstring& s)
 {
-#ifdef CAROB_USE_LOG4CXX
+#ifdef CAROB_LOG4CXX_NAME
   LOG4CXX_ERROR(logger, StaticCodecs::toString(fctName + L": " + s));
 #else
   if (isErrorEnabled())
@@ -157,7 +153,7 @@
 }
 void CarobNS::logFatal(const wstring& fctName, const wstring& s)
 {
-#ifdef CAROB_USE_LOG4CXX
+#ifdef CAROB_LOG4CXX_NAME
   LOG4CXX_FATAL(logger, StaticCodecs::toString(fctName + L": " + s));
 #else
   if (isFatalEnabled())
@@ -181,7 +177,7 @@
 
 bool CarobNS::isDebugEnabled()
 {
-#ifdef CAROB_USE_LOG4CXX
+#ifdef CAROB_LOG4CXX_NAME
   return log4cxx::Level::DEBUG->isGreaterOrEqual(logger->getLevel());
 #else
   return currentLogLevel <= LOG_LEVEL_DEBUG;
@@ -189,7 +185,7 @@
 }
 bool CarobNS::isInfoEnabled()
 {
-#ifdef CAROB_USE_LOG4CXX
+#ifdef CAROB_LOG4CXX_NAME
   return log4cxx::Level::INFO->isGreaterOrEqual(logger->getLevel());
 #else
   return currentLogLevel <= LOG_LEVEL_INFO;
@@ -197,7 +193,7 @@
 }
 bool CarobNS::isWarnEnabled()
 {
-#ifdef CAROB_USE_LOG4CXX
+#ifdef CAROB_LOG4CXX_NAME
   return log4cxx::Level::WARN->isGreaterOrEqual(logger->getLevel());
 #else
   return currentLogLevel <= LOG_LEVEL_WARN;
@@ -205,7 +201,7 @@
 }
 bool CarobNS::isErrorEnabled()
 {
-#ifdef CAROB_USE_LOG4CXX
+#ifdef CAROB_LOG4CXX_NAME
   return log4cxx::Level::ERROR->isGreaterOrEqual(logger->getLevel());
 #else
   return currentLogLevel <= LOG_LEVEL_ERROR;
@@ -213,7 +209,7 @@
 }
 bool CarobNS::isFatalEnabled()
 {
-#ifdef CAROB_USE_LOG4CXX
+#ifdef CAROB_LOG4CXX_NAME
   return log4cxx::Level::FATAL->isGreaterOrEqual(logger->getLevel());
 #else
   return currentLogLevel <= LOG_LEVEL_FATAL;
Index: carob/test/CarobTestLauncher.cpp
diff -u carob/test/CarobTestLauncher.cpp:1.39 
carob/test/CarobTestLauncher.cpp:1.40
--- carob/test/CarobTestLauncher.cpp:1.39       Wed Dec 20 21:19:40 2006
+++ carob/test/CarobTestLauncher.cpp    Wed Dec 27 16:21:49 2006
@@ -30,7 +30,7 @@
 #include "CarobException.hpp"
 #include "StringCodecs.hpp"
 #include "Common.hpp"
-#ifdef CAROB_USE_LOG4CXX
+#ifdef CAROB_LOG4CXX_NAME
 #include <log4cxx/logger.h>
 #include <log4cxx/basicconfigurator.h>
 #include <log4cxx/propertyconfigurator.h>
@@ -168,7 +168,7 @@
 
 int main (int argc, char **argv)
 {
-#ifdef CAROB_USE_LOG4CXX
+#ifdef CAROB_LOG4CXX_NAME
   // Set up a simple configuration that logs on the console.
   log4cxx::BasicConfigurator::configure();
 #endif

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to