Hi,
the attached patch adds a missing constructor which
takes a wstring& to the NDC class.
If there are not objections, I will commit it.
Thanks,
Andreas
Index: src/ndc.cpp
===================================================================
RCS file: /home/cvspublic/logging-log4cxx/src/ndc.cpp,v
retrieving revision 1.15
diff -u -r1.15 ndc.cpp
--- src/ndc.cpp 11 Mar 2005 06:34:49 -0000 1.15
+++ src/ndc.cpp 23 Jul 2005 20:39:55 -0000
@@ -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);
}
Index: include/log4cxx/ndc.h
===================================================================
RCS file: /home/cvspublic/logging-log4cxx/include/log4cxx/ndc.h,v
retrieving revision 1.15
diff -u -r1.15 ndc.h
--- include/log4cxx/ndc.h 4 May 2005 16:13:40 -0000 1.15
+++ include/log4cxx/ndc.h 23 Jul 2005 20:39:56 -0000
@@ -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();
/**