3 //=============================================================================
5 * @file Log_Msg_Callback.h
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
9 //=============================================================================
11 #ifndef ACE_LOG_MSG_CALLBACK_H
12 #define ACE_LOG_MSG_CALLBACK_H
13 #include /**/ "ace/pre.h"
15 #include /**/ "ace/ACE_export.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
26 * @class ACE_Log_Msg_Callback
28 * @brief An interface class used to get logging callbacks.
30 * Users who are interested in getting the logging messages
31 * directly, can subclass this interface and override the log()
32 * method. They must then register their subclass with the
33 * Log_Msg class and make sure that they turn on the
34 * ACE_Log_Msg::MSG_CALLBACK flag.
36 * Your log() routine is called with an instance of
37 * ACE_Log_Record. From this class, you can get the log
38 * message, the verbose log message, message type, message
39 * priority, and so on.
41 * Remember that there is one Log_Msg object per thread.
42 * Therefore, you may need to register your callback object with
43 * many ACE_Log_Msg objects (and have the correct
44 * synchronization in the log() method) or have a separate
45 * callback object per Log_Msg object. Moreover,
46 * ACE_Log_Msg_Callbacks are not inherited when a new thread
47 * is spawned because it might have been allocated off of the
48 * stack of the original thread, in which case all hell would
49 * break loose... Therefore, you'll need to reset these in each
52 class ACE_Export ACE_Log_Msg_Callback
55 /// Default constructor
56 ACE_Log_Msg_Callback () = default;
58 /// No-op virtual destructor.
59 virtual ~ACE_Log_Msg_Callback () = default;
61 /// Callback routine. This is called when we want to log a message.
62 /// Since this routine is pure virtual, it must be overwritten by the
64 virtual void log (ACE_Log_Record
&log_record
) = 0;
67 ACE_END_VERSIONED_NAMESPACE_DECL
69 #include /**/ "ace/post.h"
70 #endif /* ACE_LOG_MSG_CALLBACK_H */