diff options
author | huangh <huangh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2013-04-11 19:46:15 +0000 |
---|---|---|
committer | huangh <huangh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2013-04-11 19:46:15 +0000 |
commit | d8a0b873740f9fb69d552cd0fd2df52635d4e0bd (patch) | |
tree | 360ba8321d0190422a449b87be00a6b34cd4decd /ACE/ace/Log_Category.h | |
parent | b73cdef9288bfcb88b45c1d320d377b03007d1b3 (diff) | |
download | ATCD-d8a0b873740f9fb69d552cd0fd2df52635d4e0bd.tar.gz |
Thu Apr 11 19:42:14 UTC 2013 Huang-Ming Huang <huangh@ociweb.com>
Diffstat (limited to 'ACE/ace/Log_Category.h')
-rw-r--r-- | ACE/ace/Log_Category.h | 57 |
1 files changed, 50 insertions, 7 deletions
diff --git a/ACE/ace/Log_Category.h b/ACE/ace/Log_Category.h index 9bad1b208fb..73274be42f6 100644 --- a/ACE/ace/Log_Category.h +++ b/ACE/ace/Log_Category.h @@ -69,7 +69,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL do { \ int const __ace_error = ACE_Log_Msg::last_error_adapter (); \ ACE_Log_Category_TSS *ace___ = ACE_Log_Category::ace_lib().per_thr_obj(); \ - if (ace___ == 0) break;\ + if (ace___ == 0) return Y;\ ace___->conditional_set (__FILE__, __LINE__, Y, __ace_error); \ ace___->log X; \ return Y; \ @@ -104,6 +104,15 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Log_Msg; class ACE_Log_Category; + +/** + * @class ACE_Log_Category_TSS + * + * @brief The thread specific object for a ACE_Log_Categy object. + * + * @see{ACE_Log_Categy} for detailed explaination. + */ + class ACE_Export ACE_Log_Category_TSS { public: @@ -164,16 +173,50 @@ private: u_long priority_mask_; }; - +/** + * @class ACE_Log_Category + * + * @brief Provides a categorized message logging + * abstraction. + * + * This class added another level of abstraction to + * @c ACE_Log_Msg to separate log messages into different + * categories. Logs in different categories can be independently + * enabled or disabled. Each cateogry can have a name which + * is fixed at construction. The name is not used for + * formating the messages. However, it can be used by a + * message backend object for identification and reformat + * accordingly. + * + * To log a message into a category. Create a new @c ACE_Log_Category + * and then use @c per_thr_obj() for logging. For example, + * + * \code{.cpp} + * ACE_Log_Category test_catogory("Test"); + * test_cateogry.per_thr_obj(LM_DEBUG, "Log into the Test category."); + * + * // set the process wide priority mask + * test_catogory.priority_mask(LM_DEBUG|LM_ERROR); + * + * // set the thread specific priority mask + * test_cateogry.per_thr_obj.priority_mask(LM_DEBUG); + * \endcode + */ class ACE_Export ACE_Log_Category { public: - /// Notice that ACE_Log_Category does not - /// deep copy the passed \a name; therefore, - /// you must keep the lifetime of \a name - /// longer than the newly create ACE_Log_Category - /// object. + /** + * Initialize the logger with a name. + * + * Notice that ACE_Log_Category does not + * deep copy the passed \a name; therefore, + * you must keep the lifetime of \a name + * longer than the newly create ACE_Log_Category + * object. The rational for the design is to avoid + * static initialization problem when the ACE_Log_Category + * is created in static storage. + */ ACE_Log_Category(const char* name); ~ACE_Log_Category(); |