00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Log_Msg_UNIX_Syslog.h 00006 * 00007 * $Id: Log_Msg_UNIX_Syslog.h 90388 2010-06-02 15:27:59Z vzykov $ 00008 * 00009 * @author Jerry D. De Master <jdemaster@rite-solutions.com> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef ACE_LOG_MSG_UNIX_SYSLOG_H 00014 #define ACE_LOG_MSG_UNIX_SYSLOG_H 00015 #include /**/ "ace/pre.h" 00016 00017 #include /**/ "ace/config-all.h" 00018 00019 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00020 # pragma once 00021 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00022 00023 #if !defined (ACE_LACKS_UNIX_SYSLOG) 00024 00025 #include "ace/Log_Msg_Backend.h" 00026 #include "ace/Basic_Types.h" 00027 00028 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00029 00030 /** 00031 * @class ACE_Log_Msg_UNIX_Syslog 00032 * 00033 * @brief Implements an ACE_Log_Msg_Backend that logs messages to a UNIX 00034 * system's syslog facility. 00035 */ 00036 class ACE_Export ACE_Log_Msg_UNIX_Syslog : public ACE_Log_Msg_Backend 00037 { 00038 public: 00039 /// Constructor 00040 ACE_Log_Msg_UNIX_Syslog (void); 00041 00042 /// Destructor 00043 virtual ~ACE_Log_Msg_UNIX_Syslog (void); 00044 00045 /// Open a new event log. 00046 /** 00047 * Initialize the event logging facility. 00048 * @param logger_key The name of the calling program. This name is 00049 * used as the @c ident in the syslog entries. If 00050 * it is 0 (no name), the application name as 00051 * returned from ACE_Log_Msg::program_name() is used. 00052 */ 00053 virtual int open (const ACE_TCHAR *logger_key); 00054 00055 /// Reset the backend. 00056 virtual int reset (void); 00057 00058 /// Close the backend completely. 00059 virtual int close (void); 00060 00061 /// This is called when we want to log a message. 00062 virtual ssize_t log (ACE_Log_Record &log_record); 00063 00064 private: 00065 /// Convert an ACE_Log_Priority value to the corresponding syslog priority. 00066 int convert_log_priority (ACE_UINT32 lm_priority); 00067 00068 /// Convert an ACE_Log_Priority mask to the corresponding syslog mask value. 00069 int convert_log_mask (int lm_mask); 00070 }; 00071 00072 ACE_END_VERSIONED_NAMESPACE_DECL 00073 00074 #endif /* !ACE_LACKS_UNIX_SYSLOG */ 00075 00076 #include /**/ "ace/post.h" 00077 #endif /* ACE_LOG_MSG_UNIX_SYSLOG_H */