Author: afester Date: Mon May 14 09:43:12 2007 New Revision: 537905 URL: http://svn.apache.org/viewvc?view=rev&rev=537905 Log: LOGCXX-14: Made Logger::error and dependant methods const to avoid "cast to non-const" warning
Modified: logging/log4cxx/trunk/include/log4cxx/logger.h logging/log4cxx/trunk/src/logger.cpp Modified: logging/log4cxx/trunk/include/log4cxx/logger.h URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/include/log4cxx/logger.h?view=diff&rev=537905&r1=537904&r2=537905 ============================================================================== --- logging/log4cxx/trunk/include/log4cxx/logger.h (original) +++ logging/log4cxx/trunk/include/log4cxx/logger.h Mon May 14 09:43:12 2007 @@ -132,7 +132,7 @@ to log the particular log request. @param event the event to log. */ - void callAppenders(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p); + void callAppenders(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p) const; /** Close all attached appenders implementing the AppenderAttachable @@ -176,9 +176,9 @@ @param line the line where the log statement was written. */ void error(const std::string& msg, const log4cxx::spi::LocationInfo& location); - void error(const std::string& msg); + void error(const std::string& msg) const; #if LOG4CXX_HAS_WCHAR_T - void error(const std::wstring& msg); + void error(const std::wstring& msg) const; void error(const std::wstring& msg, const log4cxx::spi::LocationInfo& location); #endif @@ -211,14 +211,12 @@ */ void forcedLog(const LevelPtr& level, const std::string& message, const log4cxx::spi::LocationInfo& location); - void forcedLog(const LevelPtr& level, const std::string& message); + void forcedLog(const LevelPtr& level, const std::string& message) const; #if LOG4CXX_HAS_WCHAR_T void forcedLog(const LevelPtr& level, const std::wstring& message, const log4cxx::spi::LocationInfo& location); - - - void forcedLog(const LevelPtr& level, const std::wstring& message); + void forcedLog(const LevelPtr& level, const std::wstring& message) const; #endif /** Modified: logging/log4cxx/trunk/src/logger.cpp URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/logger.cpp?view=diff&rev=537905&r1=537904&r2=537905 ============================================================================== --- logging/log4cxx/trunk/src/logger.cpp (original) +++ logging/log4cxx/trunk/src/logger.cpp Mon May 14 09:43:12 2007 @@ -66,7 +66,7 @@ } -void Logger::callAppenders(const spi::LoggingEventPtr& event, Pool& p) +void Logger::callAppenders(const spi::LoggingEventPtr& event, Pool& p) const { int writes = 0; @@ -122,7 +122,7 @@ } #endif -void Logger::forcedLog(const LevelPtr& level1, const std::string& message) +void Logger::forcedLog(const LevelPtr& level1, const std::string& message) const { Pool p; LOG4CXX_DECODE_CHAR(msg, message); @@ -132,7 +132,7 @@ } #if LOG4CXX_HAS_WCHAR_T -void Logger::forcedLog(const LevelPtr& level1, const std::wstring& message) +void Logger::forcedLog(const LevelPtr& level1, const std::wstring& message) const { Pool p; LOG4CXX_DECODE_WCHAR(msg, message); @@ -228,7 +228,7 @@ } catch (MissingResourceException&) { - ((Logger *)this)->error(LOG4CXX_STR("No resource is associated with key \"") + + error(LOG4CXX_STR("No resource is associated with key \"") + key + LOG4CXX_STR("\".")); return LogString(); @@ -617,14 +617,14 @@ } #if LOG4CXX_HAS_WCHAR_T -void Logger::error(const std::wstring& msg) { +void Logger::error(const std::wstring& msg) const { if (isEnabledFor(log4cxx::Level::getError())) { forcedLog(log4cxx::Level::getError(), msg); } } #endif -void Logger::error(const std::string& msg) { +void Logger::error(const std::string& msg) const { if (isEnabledFor(log4cxx::Level::getError())) { forcedLog(log4cxx::Level::getError(), msg); }