Date: Wednesday, December 27, 2006 @ 15:04:59
  Author: marc
    Path: /cvsroot/carob/carob

Modified: include/Common.hpp (1.51 -> 1.52) src/Common.cpp (1.52 -> 1.53)

String name of carob log4cxx logger can now be overriden using 
-DCAROB_LOG4CXX_NAME
Default is still "Carob". Useful for libmysequoia.


--------------------+
 include/Common.hpp |    6 ++++--
 src/Common.cpp     |   15 ++++++++++++---
 2 files changed, 16 insertions(+), 5 deletions(-)


Index: carob/include/Common.hpp
diff -u carob/include/Common.hpp:1.51 carob/include/Common.hpp:1.52
--- carob/include/Common.hpp:1.51       Thu Dec 21 22:48:12 2006
+++ carob/include/Common.hpp    Wed Dec 27 15:04:59 2006
@@ -46,8 +46,10 @@
 
 #if 0 // CAROB_USE_LOG4CXX
 // This is disabled to avoid including log4cxx headers EVERYWHERE,
-// You can safely copy/paste this in your cpp carob client instead
-// (a forward does not seem possible...)
+// and because most people don't need to do any advanced log4cxx
+// tricks.  You can safely copy/paste this in your cpp carob client
+// to declare this method if you need to.
+// (a forward declaration of LoggerPtr does not seem possible?)
 #include <log4cxx/logger.h>
 namespace CarobNS
 {
Index: carob/src/Common.cpp
diff -u carob/src/Common.cpp:1.52 carob/src/Common.cpp:1.53
--- carob/src/Common.cpp:1.52   Thu Dec 21 22:48:12 2006
+++ carob/src/Common.cpp        Wed Dec 27 15:04:59 2006
@@ -59,12 +59,21 @@
 using std::wcerr;
 using std::endl;
 
-//LOG4CXX
+
 #ifdef CAROB_USE_LOG4CXX
 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)
+
 namespace
 {
-  LoggerPtr logger(Logger::getLogger("Carob"));
+  LoggerPtr logger(Logger::getLogger(TOSTRING(CAROB_LOG4CXX_NAME)));
 }
 
 namespace CarobNS {
@@ -73,7 +82,7 @@
   return logger;
 }
 }
-#endif
+#endif //  CAROB_USE_LOG4CXX
 
 
 // On linux or MACOSX>10.4 try "locale -a" to get the list of all available 
locales.

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

Reply via email to