26 #ifndef _LO4CPLUS_NDC_HEADER_
27 #define _LO4CPLUS_NDC_HEADER_
31 #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
43 struct DiagnosticContext;
265 template <
typename StringType>
267 void push_worker (StringType
const &);
271 NDC& operator=(
const NDC&);
This class ensures that a NDC::push() call is always matched with a NDC::pop() call even in the face ...
~NDCContextCreator()
Pops the NDC stack.
NDCContextCreator(NDCContextCreator const &)=delete
NDCContextCreator(const log4cplus::tstring &msg)
Pushes msg onto the NDC stack.
NDCContextCreator(tchar const *msg)
NDCContextCreator()=delete
NDCContextCreator(NDCContextCreator &&)=delete
The NDC class implements nested diagnostic contexts as defined by Neil Harrison in the article "Patte...
std::size_t getDepth() const
Get the current nesting depth of this diagnostic context.
log4cplus::tstring pop()
Clients should call this method before leaving a diagnostic context.
void remove()
Remove the diagnostic context for this thread.
void push(tchar const *message)
void push(const log4cplus::tstring &message)
Push new diagnostic context information for the current thread.
log4cplus::tstring const & get() const
Used when printing the diagnostic context.
void inherit(const DiagnosticContextStack &stack)
Inherit the diagnostic context of another thread.
log4cplus::tstring const & peek() const
Looks at the last diagnostic context at the top of this NDC without removing it.
DiagnosticContextStack cloneStack() const
Clone the diagnostic context for the current thread.
void clear()
Clear any nested diagnostic information if any.
void pop_void()
Same as pop() but without the return value.
void setMaxDepth(std::size_t maxDepth)
Set maximum depth of this diagnostic context.
#define LOG4CPLUS_PRIVATE
LOG4CPLUS_EXPORT NDC & getNDC()
Return a reference to the singleton object.
std::basic_string< tchar > tstring
std::deque< DiagnosticContext > DiagnosticContextStack
This is the internal object that is stored on the NDC stack.
DiagnosticContext(DiagnosticContext &&)
log4cplus::tstring message
log4cplus::tstring fullMessage
DiagnosticContext(const log4cplus::tstring &message, DiagnosticContext const *parent)
DiagnosticContext(tchar const *message)
void swap(DiagnosticContext &)
DiagnosticContext(tchar const *message, DiagnosticContext const *parent)
DiagnosticContext(const log4cplus::tstring &message)
DiagnosticContext(DiagnosticContext const &)