00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Log_Msg_Backend.h 00006 * 00007 * Log_Msg_Backend.h,v 4.6 2005/10/28 16:14:53 ossama Exp 00008 * 00009 * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> 00010 */ 00011 //============================================================================= 00012 00013 00014 #ifndef ACE_LOG_MSG_BACKEND_H 00015 #define ACE_LOG_MSG_BACKEND_H 00016 #include /**/ "ace/pre.h" 00017 00018 #include "ace/ACE_export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00025 00026 class ACE_Log_Record; 00027 00028 /** 00029 * @class ACE_Log_Msg_Backend 00030 * 00031 * @brief Define the interface for ACE_Log_Msg backend strategies. 00032 * 00033 * The ACE_Log_Msg class can log to multiple backend strategies, for 00034 * example, some send messages to a remote logger, others dump to a 00035 * file, or simply to stderr. In the future we could define 00036 * interfaces that log to the syslog daemon (on UNIX), the Event log 00037 * (on NT) a temporary ring buffer, etc. 00038 */ 00039 class ACE_Export ACE_Log_Msg_Backend 00040 { 00041 public: 00042 /// No-op virtual destructor. 00043 virtual ~ACE_Log_Msg_Backend (void); 00044 00045 /// Open a new connection 00046 virtual int open (const ACE_TCHAR *logger_key) = 0; 00047 00048 /* 00049 * Reset the backend. When changing the logging destination the 00050 * backend may need to properly disconnect from the remote logging 00051 * daemon and reclaim some local resources. But we try to reduce 00052 * the number of local allocations/deallocations. 00053 */ 00054 virtual int reset (void) = 0; 00055 00056 /// Close the backend completely. 00057 virtual int close (void) = 0; 00058 00059 /// Backend routine. This is called when we want to log a message. 00060 /// Since this routine is pure virtual, it must be overwritten by the 00061 /// subclass. 00062 virtual int log (ACE_Log_Record &log_record) = 0; 00063 }; 00064 00065 ACE_END_VERSIONED_NAMESPACE_DECL 00066 00067 #include /**/ "ace/post.h" 00068 #endif /* ACE_LOG_MSG_BACKEND_H */