00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Log_Msg_Callback.h 00006 * 00007 * $Id: Log_Msg_Callback.h,v 1.1.1.2 2003/02/21 18:36:32 chad 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 class ACE_Log_Record; 00024 00025 /** 00026 * @class ACE_Log_Msg_Callback 00027 * 00028 * @brief An interface class used to get logging callbacks. 00029 * 00030 * Users who are interested in getting the logging messages 00031 * directly, can subclass this interface and override the log() 00032 * method. They must then register their subclass with the 00033 * Log_Msg class and make sure that they turn on the 00034 * ACE_Log_Msg::MSG_CALLBACK flag. 00035 * 00036 * Your <log> routine is called with an instance of 00037 * ACE_Log_Record. From this class, you can get the log 00038 * message, the verbose log message, message type, message 00039 * priority, and so on. 00040 * 00041 * Remember that there is one Log_Msg object per thread. 00042 * Therefore, you may need to register your callback object with 00043 * many <ACE_Log_Msg> objects (and have the correct 00044 * synchronization in the <log> method) or have a separate 00045 * callback object per Log_Msg object. Moreover, 00046 * <ACE_Log_Msg_Callbacks> are not inherited when a new thread 00047 * is spawned because it might have been allocated off of the 00048 * stack of the original thread, in which case all hell would 00049 * break loose... Therefore, you'll need to reset these in each 00050 * new thread. 00051 */ 00052 class ACE_Export ACE_Log_Msg_Callback 00053 { 00054 public: 00055 /// No-op virtual destructor. 00056 virtual ~ACE_Log_Msg_Callback (void); 00057 00058 /// Callback routine. This is called when we want to log a message. 00059 /// Since this routine is pure virtual, it must be overwritten by the 00060 /// subclass. 00061 virtual void log (ACE_Log_Record &log_record) = 0; 00062 }; 00063 00064 #include "ace/post.h" 00065 #endif /* ACE_LOG_MSG_CALLBACK_H */
1.2.14 written by Dimitri van Heesch,
© 1997-2002