00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Log_Msg_Backend.h 00006 * 00007 * $Id: Log_Msg_Backend.h 78245 2007-05-02 12:50:09Z johnnyw $ 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 #include "ace/os_include/sys/os_types.h" 00025 00026 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00027 00028 class ACE_Log_Record; 00029 00030 /** 00031 * @class ACE_Log_Msg_Backend 00032 * 00033 * @brief Defines the interface for ACE_Log_Msg back end processing. 00034 * 00035 * The ACE_Log_Msg class uses ACE_Log_Msg_Backend as the target interface 00036 * for back end log record procesing. In addition to the classes ACE 00037 * derives from this (ACE_Log_Msg_NT_Event_Log, ACE_Log_Msg_UNIX_Syslog, and 00038 * ACE_Log_Msg_IPC) users can derive classes from ACE_Log_Msg_Backend for 00039 * use as a custom logger back end. 00040 */ 00041 class ACE_Export ACE_Log_Msg_Backend 00042 { 00043 public: 00044 /// No-op virtual destructor. 00045 virtual ~ACE_Log_Msg_Backend (void); 00046 00047 /** 00048 * Open the back end object. Perform any actions needed to prepare 00049 * the object for later logging operations. 00050 * 00051 * @param logger_key The character string passed to ACE_Log_Msg::open(). 00052 * If the @c LOGGER logging destination is not being 00053 * used, any string can be passed through to the back end. 00054 * 00055 * @retval 0 for success. 00056 * @retval -1 for failure. 00057 */ 00058 virtual int open (const ACE_TCHAR *logger_key) = 0; 00059 00060 /** 00061 * Reset the backend. If ACE_Log_Msg is reopened during execution, this 00062 * hook will be called. This method should perform any needed cleanup 00063 * activity (similar to close()) because this object won't be reopened 00064 * if the new open call does not specify use of this back end being reset. 00065 * 00066 * @retval Currently ignored, but to be safe, return 0 for success; 00067 * -1 for failure. 00068 */ 00069 virtual int reset (void) = 0; 00070 00071 /// Close the backend completely. 00072 virtual int close (void) = 0; 00073 00074 /** 00075 * Process a log record. 00076 * 00077 * @param log_record The ACE_Log_Record to process. 00078 * 00079 * @retval -1 for failure; else it is customarily the number of bytes 00080 * processed, but can also be 0 to signify success. 00081 */ 00082 virtual ssize_t log (ACE_Log_Record &log_record) = 0; 00083 }; 00084 00085 ACE_END_VERSIONED_NAMESPACE_DECL 00086 00087 #include /**/ "ace/post.h" 00088 #endif /* ACE_LOG_MSG_BACKEND_H */