Detailed Description

Provides a variable length argument message logging abstraction.

This class is very flexible since it allows formatted error messages to be printed in a thread-safe manner to various locations, such as stdout, stderr, cerr, a distributed logger, etc. The current message is also kept in a thread-specific storage location (threads spawned using ACE_Thread_Manager automatically get an ACE_Log_Msg object that inherits the spawning thread's settings), which can be used to communicate errors between framework methods and callers. A message is logged by the log() method, only if the message priority is currently enabled. Moreover, only the current log message is stored here -- it will be overwritten by the subsequent call to log().

The ACE_Log_Msg class uses two priority masks to control its logging behavior. The priority_mask_ object attribute is thread- specific and specifies the priority levels logged by the thread. The process_priority_mask_ class attribute is not thread-specific and specifies the priority levels that will be logged by all threads in the process. By default, all levels are disabled for priority_mask_ and all levels are enabled for process_priority_mask_ (i.e. the process-wide mask controls the settings, and each instance can expand on it if desired). Both priority masks can be modified using the priority_mask() method of this class.

Member Enumeration Documentation

anonymous enum

Enumerator:

STDERR

Write messages to stderr.

LOGGER

Write messages to the local client logger deamon.

OSTREAM

Write messages to the ostream * stored in thread-specific storage.

MSG_CALLBACK

Write messages to the callback object.

VERBOSE

Display messages in a verbose manner.

VERBOSE_LITE

Display messages in a less verbose manner (i.e., only print information that can change between calls).

SILENT

Do not print messages at all (just leave in thread-specific storage for later inspection).

Set a new callback object and return the existing callback to allow "chaining". Note that ACE_Log_Msg_Callback objects are not inherited when spawning a new thread, so you'll need to reset them in each thread.

ACE_OSTREAM_TYPE * ACE_Log_Msg::msg_ostream

(

void

)

const

Get the ostream that is used to print error messages.

void ACE_Log_Msg::msg_ostream

(

ACE_OSTREAM_TYPE *

,

int

delete_ostream

)

delete_stream == 1, forces Log_Msg.h to delete the stream in its own ~dtor (assumes control of the stream) use only with proper ostream (eg: fstream), not (cout, cerr)

void ACE_Log_Msg::msg_ostream

(

ACE_OSTREAM_TYPE *

)

Update the ostream without overwriting the delete_ostream_ flag.

int ACE_Log_Msg::op_status

(

void

)

Get the result of the operation status (by convention, -1 means error).

void ACE_Log_Msg::op_status

(

int

status

)

Set the result of the operation status (by convention, -1 means error).

If we're running in the context of an ACE_Thread_Manager this will point to the thread descriptor adapter which holds the thread descriptor of the thread. This can be used to repidly access all thread data kept in ACE_Thread_Descriptor.