ACE  6.1.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
ACE_Log_Category Class Reference

Provides a categorized message logging abstraction. More...

#include <Log_Category.h>

Collaboration diagram for ACE_Log_Category:
Collaboration graph

Public Member Functions

 ACE_Log_Category (const char *name)
 ~ACE_Log_Category ()
unsigned int id ()
const char * name ()
ACE_Log_Category_TSSper_thr_obj ()
u_long priority_mask ()
 Get the process ACE_Log_Priority mask. More...
u_long priority_mask (u_long)
 Set the process ACE_Log_Priority mask, returns original mask. More...

Static Public Member Functions

static ACE_Log_Categoryace_lib ()

Private Member Functions

 ACE_Log_Category (const ACE_Log_Category &)
ACE_Log_Categoryoperator= (const ACE_Log_Category &)

Private Attributes

const char * name_
unsigned int id_
u_long priority_mask_
ACE_Thread_Mutex keylock_
 Avoid race conditions during initialization. More...
ACE_thread_key_t key_


class ACE_Log_Category_TSS

Detailed Description

Provides a categorized message logging abstraction.

This class added another level of abstraction to 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 ACE_Log_Category and then use per_thr_obj() for logging. For example,

ACE_Log_Category test_catogory("Test");
test_cateogry.per_thr_obj()->log(LM_DEBUG, "Log into the Test category.");
// set the process wide priority mask
// set the thread specific priority mask

Constructor & Destructor Documentation

ACE_Log_Category::ACE_Log_Category ( const char *  name)

Initialize the logger with a name.

Notice that ACE_Log_Category does not deep copy the passed name; therefore, you must keep the lifetime of 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.

Default per-process priority mask By default, all priorities are enabled.

ACE_Log_Category::~ACE_Log_Category ( )
ACE_Log_Category::ACE_Log_Category ( const ACE_Log_Category )

Member Function Documentation

ACE_Log_Category & ACE_Log_Category::ace_lib ( )
unsigned int ACE_Log_Category::id ( )
const char * ACE_Log_Category::name ( void  )
ACE_Log_Category& ACE_Log_Category::operator= ( const ACE_Log_Category )
ACE_Log_Category_TSS * ACE_Log_Category::per_thr_obj ( )
u_long ACE_Log_Category::priority_mask ( )

Get the process ACE_Log_Priority mask.

Get the current ACE_Log_Priority mask.

u_long ACE_Log_Category::priority_mask ( u_long  n_mask)

Set the process ACE_Log_Priority mask, returns original mask.

Set the ACE_Log_Priority mask, returns original mask.

Friends And Related Function Documentation

friend class ACE_Log_Category_TSS

Member Data Documentation

unsigned int ACE_Log_Category::id_
ACE_thread_key_t ACE_Log_Category::key_

"First time in" flag. Key for the thread-specific error data.

ACE_Thread_Mutex ACE_Log_Category::keylock_

Avoid race conditions during initialization.

we couldn't directly use ACE_TSS because it would create circular dependency

const char* ACE_Log_Category::name_
u_long ACE_Log_Category::priority_mask_

The documentation for this class was generated from the following files: