Author: afester Date: Thu Dec 22 11:13:00 2005 New Revision: 358606 URL: http://svn.apache.org/viewcvs?rev=358606&view=rev Log: LOGCXX-124: Added missing std::wstring& constructor to NDC class
Modified: logging/log4cxx/trunk/include/log4cxx/ndc.h logging/log4cxx/trunk/src/ndc.cpp Modified: logging/log4cxx/trunk/include/log4cxx/ndc.h URL: http://svn.apache.org/viewcvs/logging/log4cxx/trunk/include/log4cxx/ndc.h?rev=358606&r1=358605&r2=358606&view=diff ============================================================================== --- logging/log4cxx/trunk/include/log4cxx/ndc.h (original) +++ logging/log4cxx/trunk/include/log4cxx/ndc.h Thu Dec 22 11:13:00 2005 @@ -112,7 +112,28 @@ public: typedef std::stack<DiagnosticContext> Stack; - NDC(const LogString& message); + /** + Creates a nested diagnostic context. + Since java performs no automatic cleanup of objects when a + scope is left, in log4j push() and pop() must be used + to manage the NDC. For convenience, log4cxx provides + an NDC constructor and destructor which simply call the push() and + pop() methods, allowing for automatic cleanup when the current + scope ends. + + @param message The new diagnostic context information. + @see The #push method. + */ +#if LOG4CXX_HAS_WCHAR_T + NDC(const std::wstring& message); +#endif + NDC(const std::string& message); + + /** + Removes the topmost element from the NDC stack. + + @see The #pop method. + */ ~NDC(); /** Modified: logging/log4cxx/trunk/src/ndc.cpp URL: http://svn.apache.org/viewcvs/logging/log4cxx/trunk/src/ndc.cpp?rev=358606&r1=358605&r2=358606&view=diff ============================================================================== --- logging/log4cxx/trunk/src/ndc.cpp (original) +++ logging/log4cxx/trunk/src/ndc.cpp Thu Dec 22 11:13:00 2005 @@ -47,7 +47,14 @@ return *this; } -NDC::NDC(const LogString& message) +#if LOG4CXX_HAS_WCHAR_T +NDC::NDC(const std::wstring& message) +{ + push(message); +} +#endif + +NDC::NDC(const std::string& message) { push(message); }