00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Log_Msg_Callback.h 00006 * 00007 * Log_Msg_Callback.h,v 4.7 2006/04/27 11:17:55 jwillemsen Exp 00008 * 00009 * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef ACE_LOG_MSG_CALLBACK_H 00014 #define ACE_LOG_MSG_CALLBACK_H 00015 #include /**/ "ace/pre.h" 00016 00017 #include "ace/ACE_export.h" 00018 00019 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00020 # pragma once 00021 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00022 00023 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00024 00025 class ACE_Log_Record; 00026 00027 /** 00028 * @class ACE_Log_Msg_Callback 00029 * 00030 * @brief An interface class used to get logging callbacks. 00031 * 00032 * Users who are interested in getting the logging messages 00033 * directly, can subclass this interface and override the log() 00034 * method. They must then register their subclass with the 00035 * Log_Msg class and make sure that they turn on the 00036 * ACE_Log_Msg::MSG_CALLBACK flag. 00037 * 00038 * Your <log> routine is called with an instance of 00039 * ACE_Log_Record. From this class, you can get the log 00040 * message, the verbose log message, message type, message 00041 * priority, and so on. 00042 * 00043 * Remember that there is one Log_Msg object per thread. 00044 * Therefore, you may need to register your callback object with 00045 * many ACE_Log_Msg objects (and have the correct 00046 * synchronization in the <log> method) or have a separate 00047 * callback object per Log_Msg object. Moreover, 00048 * <ACE_Log_Msg_Callbacks> are not inherited when a new thread 00049 * is spawned because it might have been allocated off of the 00050 * stack of the original thread, in which case all hell would 00051 * break loose... Therefore, you'll need to reset these in each 00052 * new thread. 00053 */ 00054 class ACE_Export ACE_Log_Msg_Callback 00055 { 00056 public: 00057 /// No-op virtual destructor. 00058 virtual ~ACE_Log_Msg_Callback (void); 00059 00060 /// Callback routine. This is called when we want to log a message. 00061 /// Since this routine is pure virtual, it must be overwritten by the 00062 /// subclass. 00063 virtual void log (ACE_Log_Record &log_record) = 0; 00064 }; 00065 00066 ACE_END_VERSIONED_NAMESPACE_DECL 00067 00068 #include /**/ "ace/post.h" 00069 #endif /* ACE_LOG_MSG_CALLBACK_H */