Date: Wednesday, December 27, 2006 @ 15:54:43
Author: marc
Path: /cvsroot/carob/carob/src
Modified: Common.cpp (1.53 -> 1.54)
Removed the redundant isDebugEnabled()-like tests in logging functions when
using log4cxx
------------+
Common.cpp | 37 +++++++++++--------------------------
1 files changed, 11 insertions(+), 26 deletions(-)
Index: carob/src/Common.cpp
diff -u carob/src/Common.cpp:1.53 carob/src/Common.cpp:1.54
--- carob/src/Common.cpp:1.53 Wed Dec 27 15:04:59 2006
+++ carob/src/Common.cpp Wed Dec 27 15:54:43 2006
@@ -120,64 +120,49 @@
void CarobNS::logDebug(const wstring& fctName, const wstring& s)
{
- if (isDebugEnabled())
- {
#ifdef CAROB_USE_LOG4CXX
- // Log4cxx <= 0.9.7 doesn't accept wstrings - we have to convert the string
- std::string tmp = CarobNS::StaticCodecs::toString(fctName + L": " + s);
- LOG4CXX_DEBUG(logger, tmp);
+ // Log4cxx <= 0.9.7 doesn't accept wstrings - we have to convert the string
+ LOG4CXX_DEBUG(logger, StaticCodecs::toString(fctName + L": " + s));
#else
+ if (isDebugEnabled())
wcerr << DEBUG_PRE << L'(' << fctName << L") " << s << endl;
#endif
- }
}
void CarobNS::logInfo(const wstring& fctName, const wstring& s)
{
- if (isInfoEnabled())
- {
#ifdef CAROB_USE_LOG4CXX
- std::string tmp = CarobNS::StaticCodecs::toString(fctName + L": " + s);
- LOG4CXX_INFO(logger, tmp);
+ LOG4CXX_INFO(logger, StaticCodecs::toString(fctName + L": " + s));
#else
+ if (isInfoEnabled())
wcerr << INFO_PRE << L'(' << fctName << L") " << s << endl;
#endif
- }
}
void CarobNS::logWarn(const wstring& fctName, const wstring& s)
{
- if (isWarnEnabled())
- {
#ifdef CAROB_USE_LOG4CXX
- std::string tmp = CarobNS::StaticCodecs::toString(fctName + L": " + s);
- LOG4CXX_WARN(logger, tmp);
+ LOG4CXX_WARN(logger, StaticCodecs::toString(fctName + L": " + s));
#else
+ if (isWarnEnabled())
wcerr << WARN_PRE << L'(' << fctName << L") " << s << endl;
#endif
- }
}
void CarobNS::logError(const wstring& fctName, const wstring& s)
{
- if (isErrorEnabled())
- {
#ifdef CAROB_USE_LOG4CXX
- std::string tmp = CarobNS::StaticCodecs::toString(fctName + L": " + s);
- LOG4CXX_ERROR(logger, tmp);
+ LOG4CXX_ERROR(logger, StaticCodecs::toString(fctName + L": " + s));
#else
+ if (isErrorEnabled())
wcerr << ERROR_PRE << L'(' << fctName << L") " << s << endl;
#endif
- }
}
void CarobNS::logFatal(const wstring& fctName, const wstring& s)
{
- if (isFatalEnabled())
- {
#ifdef CAROB_USE_LOG4CXX
- std::string tmp = CarobNS::StaticCodecs::toString(fctName + L": " + s);
- LOG4CXX_FATAL(logger, tmp);
+ LOG4CXX_FATAL(logger, StaticCodecs::toString(fctName + L": " + s));
#else
+ if (isFatalEnabled())
wcerr << FATAL_PRE << L'(' << fctName << L") " << s << endl;
#endif
- }
}
namespace {
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits