Date: Friday, March 16, 2007 @ 12:40:14
Author: marc
Path: /cvsroot/carob/carob
Modified: make-includes/defaults.mk (1.6 -> 1.7) src/Common.cpp (1.69 ->
1.70)
Logs are now prefixed by "Carob-x.y.z::"
---------------------------+
make-includes/defaults.mk | 2 --
src/Common.cpp | 31 ++++++++++++++++++++++---------
2 files changed, 22 insertions(+), 11 deletions(-)
Index: carob/make-includes/defaults.mk
diff -u carob/make-includes/defaults.mk:1.6 carob/make-includes/defaults.mk:1.7
--- carob/make-includes/defaults.mk:1.6 Fri Mar 16 11:11:16 2007
+++ carob/make-includes/defaults.mk Fri Mar 16 12:40:14 2007
@@ -30,6 +30,4 @@
CAROB_MINOR_VERSION = 7
CAROB_REVISION = .4
-# TODO: include these numbers in the logs, probably thanks to some
-# generated CarobVersion.hpp file
Index: carob/src/Common.cpp
diff -u carob/src/Common.cpp:1.69 carob/src/Common.cpp:1.70
--- carob/src/Common.cpp:1.69 Thu Feb 8 12:27:10 2007
+++ carob/src/Common.cpp Fri Mar 16 12:40:14 2007
@@ -23,6 +23,8 @@
#include "StringCodecs.hpp"
+#include "CarobVersion.hpp"
+
//LOG4CXX includes
#ifdef CAROB_LOG4CXX_NAME
#include "StringCodecs.hpp" //for toString
@@ -54,14 +56,15 @@
using std::endl;
-#ifdef CAROB_LOG4CXX_NAME
-
-using namespace log4cxx;
-
// need two steps to delay expansion of argument
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
+
+#ifdef CAROB_LOG4CXX_NAME
+
+using namespace log4cxx;
+
namespace
{
LoggerPtr logger(Logger::getLogger(TOSTRING(CAROB_LOG4CXX_NAME)));
@@ -104,8 +107,14 @@
#endif
}
-void CarobNS::logDebug(const wstring& fctName, const wstring& s)
+
+namespace {
+const std::wstring carobVersion(L"Carob-" TOSTRING(CAROB_VERSION) "::");
+}
+
+void CarobNS::logDebug(const wstring& functionName, const wstring& s)
{
+ const std::wstring fctName(carobVersion + functionName);
#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));
@@ -114,8 +123,9 @@
wcerr << DEBUG_PRE << L'(' << fctName << L") " << s << endl;
#endif
}
-void CarobNS::logInfo(const wstring& fctName, const wstring& s)
+void CarobNS::logInfo(const wstring& functionName, const wstring& s)
{
+ const std::wstring fctName(carobVersion + functionName);
#ifdef CAROB_LOG4CXX_NAME
LOG4CXX_INFO(logger, StaticCodecs::toString(fctName + L": " + s));
#else
@@ -123,8 +133,9 @@
wcerr << INFO_PRE << L'(' << fctName << L") " << s << endl;
#endif
}
-void CarobNS::logWarn(const wstring& fctName, const wstring& s)
+void CarobNS::logWarn(const wstring& functionName, const wstring& s)
{
+ const std::wstring fctName(carobVersion + functionName);
#ifdef CAROB_LOG4CXX_NAME
LOG4CXX_WARN(logger, StaticCodecs::toString(fctName + L": " + s));
#else
@@ -132,8 +143,9 @@
wcerr << WARN_PRE << L'(' << fctName << L") " << s << endl;
#endif
}
-void CarobNS::logError(const wstring& fctName, const wstring& s)
+void CarobNS::logError(const wstring& functionName, const wstring& s)
{
+ const std::wstring fctName(carobVersion + functionName);
#ifdef CAROB_LOG4CXX_NAME
LOG4CXX_ERROR(logger, StaticCodecs::toString(fctName + L": " + s));
#else
@@ -141,8 +153,9 @@
wcerr << ERROR_PRE << L'(' << fctName << L") " << s << endl;
#endif
}
-void CarobNS::logFatal(const wstring& fctName, const wstring& s)
+void CarobNS::logFatal(const wstring& functionName, const wstring& s)
{
+ const std::wstring fctName(carobVersion + functionName);
#ifdef CAROB_LOG4CXX_NAME
LOG4CXX_FATAL(logger, StaticCodecs::toString(fctName + L": " + s));
#else
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits