ACE 8.0.1
Loading...
Searching...
No Matches
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
[legend]

Public Member Functions

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

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 charname_
 
unsigned int id_
 
u_long priority_mask_
 
ACE_Thread_Mutex keylock_
 Avoid race conditions during initialization.
 
ACE_thread_key_t key_
 

Friends

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. However, they will all be affected by the priority_mask setting in ACE_Log_Msg. That is to say, if a given priority level is disabled using ACE_Log_Msg::priority_mask(), all messages of that priority level logged via any ACE_Log_Category object would also be disabled regardless of the priority_mask setting in the ACE_Log_Category object.

Each category can have a name which is fixed at construction. The name is not used for formatting 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,

test_category.per_thr_obj()->log(LM_DEBUG, "Log into the Test category.");
// set the process wide priority mask
// set the thread specific priority mask
test_category.per_thr_obj()->priority_mask(LM_DEBUG);
@ LM_DEBUG
Definition Log_Priority.h:43
@ LM_ERROR
Error messages (decimal 128).
Definition Log_Priority.h:59
This class inherits the interface of the abstract ACE_Dumpable class and is instantiated with the imp...
Definition Dump_T.h:39
Provides a categorized message logging abstraction.
Definition Log_Category.h:256

Constructor & Destructor Documentation

◆ ACE_Log_Category() [1/2]

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() [2/2]

ACE_Log_Category::ACE_Log_Category ( const ACE_Log_Category & )
private

Member Function Documentation

◆ ace_lib()

ACE_Log_Category & ACE_Log_Category::ace_lib ( )
static

◆ id()

unsigned int ACE_Log_Category::id ( ) const
inline

◆ name()

const char * ACE_Log_Category::name ( ) const
inline

◆ operator=()

ACE_Log_Category & ACE_Log_Category::operator= ( const ACE_Log_Category & )
private

◆ per_thr_obj()

ACE_Log_Category_TSS * ACE_Log_Category::per_thr_obj ( )

◆ priority_mask() [1/2]

u_long ACE_Log_Category::priority_mask ( ) const
inline

Get the process ACE_Log_Priority mask.

Get the current ACE_Log_Priority mask.

◆ priority_mask() [2/2]

u_long ACE_Log_Category::priority_mask ( u_long n_mask)
inline

Set the process ACE_Log_Priority mask, returns original mask.

Set the ACE_Log_Priority mask, returns original mask.

Friends And Related Symbol Documentation

◆ ACE_Log_Category_TSS

Member Data Documentation

◆ id_

unsigned int ACE_Log_Category::id_
private

◆ key_

ACE_thread_key_t ACE_Log_Category::key_
private

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

◆ keylock_

ACE_Thread_Mutex ACE_Log_Category::keylock_
private

Avoid race conditions during initialization.

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

◆ name_

const char* ACE_Log_Category::name_
private

◆ priority_mask_

u_long ACE_Log_Category::priority_mask_
private

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