log4cpp 1.1.3
Loading...
Searching...
No Matches
NDC.hh
Go to the documentation of this file.
1/*
2 * NDC.hh
3 *
4 * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved.
5 * Copyright 2000, Bastiaan Bakker. All rights reserved.
6 *
7 * See the COPYING file for the terms of usage and distribution.
8 */
9
10#ifndef _LOG4CPP_NDC_HH
11#define _LOG4CPP_NDC_HH
12
14#include <string>
15#include <vector>
16
17namespace log4cpp {
74 static bool isUsedNDC;
75 static const std::string emptyString;
76 public:
77
79 DiagnosticContext(const std::string& message);
80 DiagnosticContext(const std::string& message,
81 const DiagnosticContext& parent);
82
83 std::string message;
84 std::string fullMessage;
85 };
86
87 typedef std::vector<DiagnosticContext> ContextStack;
88
97 static void clear();
98
112 static ContextStack* cloneStack();
113
118 static const std::string& get();
119
124 static size_t getDepth();
125
126 static void inherit(ContextStack* stack);
127
137
138 static std::string pop();
139
148 static void push(const std::string& message);
149
156 static void setMaxDepth(int maxDepth);
157
162 static NDC& getNDC();
163
164 NDC();
165 virtual ~NDC();
166
167 public:
168 virtual void _clear();
169 virtual ContextStack* _cloneStack();
170 virtual const std::string& _get() const;
171 virtual size_t _getDepth() const;
172 virtual void _inherit(ContextStack* stack);
173 virtual std::string _pop();
174 virtual void _push(const std::string& message);
175 virtual void _setMaxDepth(int maxDepth);
176
178 };
179}
180
181#endif // _LOG4CPP_NDC_HH
#define LOG4CPP_EXPORT
Definition Export.hh:26
ContextStack _stack
Definition NDC.hh:177
virtual ContextStack * _cloneStack()
Definition NDC.cpp:92
virtual std::string _pop()
Definition NDC.cpp:110
static std::string pop()
Clients should call this method before leaving a diagnostic context.
Definition NDC.cpp:57
NDC()
Definition NDC.cpp:82
static void setMaxDepth(int maxDepth)
Set the maximum nesting depth for the current NDC.
Definition NDC.cpp:67
static size_t getDepth()
Get the current nesting depth of this diagnostic context.
Definition NDC.cpp:49
static const std::string & get()
Get the current diagnostic context string.
Definition NDC.cpp:42
virtual void _clear()
Definition NDC.cpp:88
virtual size_t _getDepth() const
Definition NDC.cpp:102
static NDC & getNDC()
Return the NDC for the current thread.
Definition NDC.cpp:71
virtual void _setMaxDepth(int maxDepth)
Definition NDC.cpp:124
static void clear()
Clear any nested disgnostic information if any.
Definition NDC.cpp:34
static void push(const std::string &message)
Push new diagnostic context information for the current thread.
Definition NDC.cpp:61
virtual void _inherit(ContextStack *stack)
Definition NDC.cpp:106
std::vector< DiagnosticContext > ContextStack
Definition NDC.hh:87
virtual void _push(const std::string &message)
Definition NDC.cpp:116
static void inherit(ContextStack *stack)
Definition NDC.cpp:53
static ContextStack * cloneStack()
Clone the diagnostic context for the current thread.
Definition NDC.cpp:38
virtual const std::string & _get() const
Definition NDC.cpp:96
The top level namespace for all 'Log for C++' types and classes.
Definition AbortAppender.hh:16
DiagnosticContext(const std::string &message)
Definition NDC.cpp:16
std::string fullMessage
Definition NDC.hh:84
std::string message
Definition NDC.hh:83