Loading...
Searching...
No Matches
NDC.hh
Go to the documentation of this file.
/*
* NDC.hh
*
* Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved.
* Copyright 2000, Bastiaan Bakker. All rights reserved.
*
* See the COPYING file for the terms of usage and distribution.
*/
#ifndef _LOG4SHIB_NDC_HH
#define _LOG4SHIB_NDC_HH
#include <log4shib/Portability.hh>
#include <string>
#include <vector>
namespace log4shib {
class LOG4SHIB_EXPORT NDC {
public:
struct DiagnosticContext {
DiagnosticContext(const std::string& message);
DiagnosticContext(const std::string& message,
const DiagnosticContext& parent);
std::string message;
std::string fullMessage;
};
typedef std::vector<DiagnosticContext> ContextStack;
static void clear();
static ContextStack* cloneStack();
static const std::string& get();
static int getDepth();
static void inherit(ContextStack* stack);
static std::string pop();
static void push(const std::string& message);
static void setMaxDepth(int maxDepth);
static NDC& getNDC();
NDC();
virtual ~NDC();
public:
virtual void _clear();
virtual ContextStack* _cloneStack();
virtual const std::string& _get() const;
virtual int _getDepth() const;
virtual void _inherit(ContextStack* stack);
virtual std::string _pop();
virtual void _push(const std::string& message);
virtual void _setMaxDepth(int maxDepth);
ContextStack _stack;
};
}
#endif // _LOG4SHIB_NDC_HH
LOG4SHIB_EXPORT
#define LOG4SHIB_EXPORT
Definition Export.hh:11
Portability.hh
log4shib::NDC::clear
static void clear()
Clear any nested disgnostic information if any.
Definition NDC.cpp:31
log4shib::NDC::_cloneStack
virtual ContextStack * _cloneStack()
Definition NDC.cpp:84
log4shib::NDC::getNDC
static NDC & getNDC()
Return the NDC for the current thread.
Definition NDC.cpp:63
log4shib::NDC::get
static const std::string & get()
Get the current diagnostic context string.
Definition NDC.cpp:39
log4shib::NDC::_setMaxDepth
virtual void _setMaxDepth(int maxDepth)
Definition NDC.cpp:116
log4shib::NDC::ContextStack
std::vector< DiagnosticContext > ContextStack
Definition NDC.hh:81
log4shib::NDC::push
static void push(const std::string &message)
Push new diagnostic context information for the current thread.
Definition NDC.cpp:55
log4shib::NDC::cloneStack
static ContextStack * cloneStack()
Clone the diagnostic context for the current thread.
Definition NDC.cpp:35
log4shib::NDC::getDepth
static int getDepth()
Get the current nesting depth of this diagnostic context.
Definition NDC.cpp:43
log4shib::NDC::pop
static std::string pop()
Clients should call this method before leaving a diagnostic context.
Definition NDC.cpp:51
log4shib::NDC::NDC
NDC()
Definition NDC.cpp:74
log4shib::NDC::_get
virtual const std::string & _get() const
Definition NDC.cpp:88
log4shib::NDC::setMaxDepth
static void setMaxDepth(int maxDepth)
Set the maximum nesting depth for the current NDC.
Definition NDC.cpp:59
log4shib::NDC::_inherit
virtual void _inherit(ContextStack *stack)
Definition NDC.cpp:98
log4shib::NDC::_getDepth
virtual int _getDepth() const
Definition NDC.cpp:94
log4shib::NDC::_pop
virtual std::string _pop()
Definition NDC.cpp:102
log4shib::NDC::_push
virtual void _push(const std::string &message)
Definition NDC.cpp:108
log4shib::NDC::_clear
virtual void _clear()
Definition NDC.cpp:80
log4shib::NDC::_stack
ContextStack _stack
Definition NDC.hh:171
log4shib::NDC::inherit
static void inherit(ContextStack *stack)
Definition NDC.cpp:47
log4shib
The top level namespace for all 'Log for C++' types and classes.
Definition AbortAppender.hh:16
log4shib::NDC::DiagnosticContext::fullMessage
std::string fullMessage
Definition NDC.hh:78
log4shib::NDC::DiagnosticContext::message
std::string message
Definition NDC.hh:77
log4shib::NDC::DiagnosticContext::DiagnosticContext
DiagnosticContext(const std::string &message)
Definition NDC.cpp:16