It provides mapped diagnostic contexts. A Mapped Diagnostic Context, or MDC in short, is an instrument for distinguishing interleaved log output from different sources. Log output is typically interleaved when a server handles multiple clients near-simultaneously.
The MDC is managed on a per thread basis. A child thread automatically inherits a copy of the mapped diagnostic context of its parent.
Public Types | |
typedef std::map< LogString, LogString > | Map |
String to string stl map. | |
Public Member Functions | |
MDC (const std::string &key, const std::string &value) | |
Places a key/value pair in the MDC for the current thread which will be removed during the corresponding destructor. | |
~MDC () | |
MDC (const std::wstring &key, const std::wstring &value) | |
Places a key/value pair in the MDC for the current thread which will be removed during the corresponding destructor. | |
MDC (const std::basic_string< UniChar > &key, const std::basic_string< UniChar > &value) | |
Places a key/value pair in the MDC for the current thread which will be removed during the corresponding destructor. | |
MDC (const CFStringRef &key, const CFStringRef &value) | |
Places a key/value pair in the MDC for the current thread which will be removed during the corresponding destructor. | |
Static Public Member Functions | |
static void | put (const std::string &key, const std::string &value) |
Put a context value (the o parameter) as identified with the key parameter into the current thread's context map. | |
static void | putLS (const LogString &key, const LogString &value) |
Put a context value (the o parameter) as identified with the key parameter into the current thread's context map. | |
static std::string | get (const std::string &key) |
Get the context identified by the key parameter. | |
static bool | get (const LogString &key, LogString &dest) |
Gets the context identified by the key parameter. | |
static std::string | remove (const std::string &key) |
Remove the the context identified by the key parameter. | |
static void | put (const std::wstring &key, const std::wstring &value) |
Put a context value (the o parameter) as identified with the key parameter into the current thread's context map. | |
static std::wstring | get (const std::wstring &key) |
Get the context identified by the key parameter. | |
static std::wstring | remove (const std::wstring &key) |
Remove the the context identified by the key parameter. | |
static void | put (const std::basic_string< UniChar > &key, const std::basic_string< UniChar > &value) |
Put a context value (the o parameter) as identified with the key parameter into the current thread's context map. | |
static std::basic_string< UniChar > | get (const std::basic_string< UniChar > &key) |
Get the context identified by the key parameter. | |
static std::basic_string< UniChar > | remove (const std::basic_string< UniChar > &key) |
Remove the the context identified by the key parameter. | |
static void | put (const CFStringRef &key, const CFStringRef &value) |
Put a context value (the o parameter) as identified with the key parameter into the current thread's context map. | |
static CFStringRef | get (const CFStringRef &key) |
Get the context identified by the key parameter. | |
static CFStringRef | remove (const CFStringRef &key) |
Remove the the context identified by the key parameter. | |
static bool | remove (const LogString &key, LogString &prevValue) |
Remove the the context identified by the key parameter. | |
static void | clear () |
Clear all entries in the MDC. |
|
String to string stl map.
|
|
Places a key/value pair in the MDC for the current thread which will be removed during the corresponding destructor. Both construction and destruction are expected to be on the same thread.
|
|
|
|
Places a key/value pair in the MDC for the current thread which will be removed during the corresponding destructor. Both construction and destruction are expected to be on the same thread.
|
|
Places a key/value pair in the MDC for the current thread which will be removed during the corresponding destructor. Both construction and destruction are expected to be on the same thread.
|
|
Places a key/value pair in the MDC for the current thread which will be removed during the corresponding destructor. Both construction and destruction are expected to be on the same thread.
|
|
Clear all entries in the MDC.
|
|
Get the context identified by the This method has no side effects.
|
|
Get the context identified by the This method has no side effects.
|
|
Get the context identified by the This method has no side effects.
|
|
Gets the context identified by the
|
|
Get the context identified by the This method has no side effects.
|
|
Put a context value (the If the current thread does not have a context map it is created as a side effect.
|
|
Put a context value (the If the current thread does not have a context map it is created as a side effect.
|
|
Put a context value (the If the current thread does not have a context map it is created as a side effect.
|
|
Put a context value (the If the current thread does not have a context map it is created as a side effect.
|
|
Put a context value (the If the current thread does not have a context map it is created as a side effect. |
|
Remove the the context identified by the
|
|
Remove the the context identified by the
|
|
Remove the the context identified by the
|
|
Remove the the context identified by the
|
|
Remove the the context identified by the
|