00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _LOG4TANGO_NDC_H
00029 #define _LOG4TANGO_NDC_H
00030
00031 #ifdef LOG4TANGO_HAS_NDC
00032
00033 #include <log4tango/Portability.hh>
00034 #include <string>
00035 #include <vector>
00036
00037 namespace log4tango {
00089 class LOG4TANGO_EXPORT NDC
00090 {
00091 public:
00092
00093 struct DiagnosticContext {
00094 DiagnosticContext(const std::string& message);
00095 DiagnosticContext(const std::string& message,
00096 const DiagnosticContext& parent);
00097
00098 std::string message;
00099 std::string full_msg;
00100 };
00101
00102 typedef std::vector<DiagnosticContext> ContextStack;
00103
00112 static void clear (void);
00113
00127 static ContextStack* clone_stack (void);
00128
00133 static const std::string& get (void);
00134
00139 static int get_depth (void);
00140
00141 static void inherit (ContextStack* stack);
00142
00152 static std::string pop (void);
00153
00162 static void push (const std::string& message);
00163
00170 static void set_max_depth (int max_depth);
00171
00176 static NDC& get_ndc();
00177
00178 NDC();
00179 virtual ~NDC();
00180
00181 public:
00182 virtual void _clear (void);
00183 virtual ContextStack* _clone_stack (void);
00184 virtual const std::string& _get (void) const;
00185 virtual int _get_depth (void) const;
00186 virtual void _inherit (ContextStack* stack);
00187 virtual std::string _pop (void);
00188 virtual void _push (const std::string& message);
00189 virtual void _set_max_depth (int max_depth);
00190
00191 ContextStack _stack;
00192 };
00193
00194 }
00195
00196 #endif // LOG4TANGO_HAS_NDC
00197
00198 #endif // _LOG4TANGO_NDC_HH