📄 ndc.h
字号:
Pop top value off stack. @return top value. */ static LogString pop(); /** Pop top value off stack. @param buf to which top value is appended. @return true if NDC contained at least one value. */ static bool pop(std::string& buf); /** Looks at the last diagnostic context at the top of this NDC without removing it. <p>The returned value is the value that was pushed last. If no context is available, then the empty string "" is returned. @return String The innermost diagnostic context. */ static LogString peek(); /** Get top value without removing value. @param buf to which top value is appended. @return true if NDC contained at least one value. */ static bool peek(std::string& buf); /** Push new diagnostic context information for the current thread. <p>The contents of the <code>message</code> parameter is determined solely by the client. @param message The new diagnostic context information. */ static void push(const std::string& message); /** Push new diagnostic context information for the current thread. <p>The contents of the <code>message</code> parameter is determined solely by the client. @param message The new diagnostic context information. */ static void pushLS(const LogString& message); /** Remove the diagnostic context for this thread. <p>Each thread that created a diagnostic context by calling #push should call this method before exiting. Otherwise, the memory used by the <b>thread</b> cannot be reclaimed by the VM. <p>As this is such an important problem in heavy duty systems and because it is difficult to always guarantee that the remove method is called before exiting a thread, this method has been augmented to lazily remove references to dead threads. In practice, this means that you can be a little sloppy and occasionally forget to call #remove before exiting a thread. However, you must call <code>remove</code> sometime. If you never call it, then your application is sure to run out of memory. */ static void remove(); #if LOG4CXX_WCHAR_T_API /** Creates a nested diagnostic context. Since java performs no automatic cleanup of objects when a scope is left, in log4j push() and pop() must be used to manage the NDC. For convenience, log4cxx provides an NDC constructor and destructor which simply call the push() and pop() methods, allowing for automatic cleanup when the current scope ends. @param message The new diagnostic context information. @see The #push method. */ NDC(const std::wstring& message); /** Push new diagnostic context information for the current thread. <p>The contents of the <code>message</code> parameter is determined solely by the client. @param message The new diagnostic context information. */ static void push(const std::wstring& message); /** * Appends the current NDC content to the provided string. * @param dst destination. * @return true if NDC value set. */ static bool peek(std::wstring& dst); /** * Appends the current NDC content to the provided string and removes the value from the NDC. * @param dst destination. * @return true if NDC value set. */ static bool pop(std::wstring& dst);#endif#if LOG4CXX_UNICHAR_API /** Creates a nested diagnostic context. Since java performs no automatic cleanup of objects when a scope is left, in log4j push() and pop() must be used to manage the NDC. For convenience, log4cxx provides an NDC constructor and destructor which simply call the push() and pop() methods, allowing for automatic cleanup when the current scope ends. @param message The new diagnostic context information. @see The #push method. */ NDC(const std::basic_string<UniChar>& message); /** Push new diagnostic context information for the current thread. <p>The contents of the <code>message</code> parameter is determined solely by the client. @param message The new diagnostic context information. */ static void push(const std::basic_string<UniChar>& message); /** * Appends the current NDC content to the provided string. * @param dst destination. * @return true if NDC value set. */ static bool peek(std::basic_string<UniChar>& dst); /** * Appends the current NDC content to the provided string and removes the value from the NDC. * @param dst destination. * @return true if NDC value set. */ static bool pop(std::basic_string<UniChar>& dst);#endif#if LOG4CXX_CFSTRING_API /** Creates a nested diagnostic context. Since java performs no automatic cleanup of objects when a scope is left, in log4j push() and pop() must be used to manage the NDC. For convenience, log4cxx provides an NDC constructor and destructor which simply call the push() and pop() methods, allowing for automatic cleanup when the current scope ends. @param message The new diagnostic context information. @see The #push method. */ NDC(const CFStringRef& message); /** Push new diagnostic context information for the current thread. <p>The contents of the <code>message</code> parameter is determined solely by the client. @param message The new diagnostic context information. */ static void push(const CFStringRef& message); /** * Gets the current NDC value. * @param dst destination. * @return true if NDC value set. */ static bool peek(CFStringRef& dst); /** * Gets and removes the current NDC value. * @param dst destination. * @return true if NDC value set. */ static bool pop(CFStringRef& dst);#endif private: NDC(const NDC&); NDC& operator=(const NDC&); static LogString& getMessage(DiagnosticContext& ctx); static LogString& getFullMessage(DiagnosticContext& ctx); }; // class NDC;} // namespace log4cxx#if defined(_MSC_VER)#pragma warning (pop)#endif#endif // _LOG4CXX_NDC_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -