libassa 3.5.0
|
00001 // -*- c++ -*- 00002 //------------------------------------------------------------------------------ 00003 // RemoteLogger.h 00004 //------------------------------------------------------------------------------ 00005 // $Id: RemoteLogger.h,v 1.1 2003/07/25 02:51:47 vlg Exp $ 00006 //------------------------------------------------------------------------------ 00007 // Copyright (c) 2003 by Vladislav Grinchenko 00008 // 00009 // This program is free software; you can redistribute it and/or 00010 // modify it under the terms of the GNU General Public License 00011 // as published by the Free Software Foundation; either version 00012 // 2 of the License, or (at your option) any later version. 00013 //------------------------------------------------------------------------------ 00014 // Created: 00015 //------------------------------------------------------------------------------ 00016 #ifndef LOG_SERVER_H 00017 #define LOG_SERVER_H 00018 00019 #include "assa/ServiceHandler.h" 00020 #include "assa/IPv4Socket.h" 00021 #include "assa/Logger_Impl.h" 00022 00023 /******************************************************************************* 00024 Class 00025 *******************************************************************************/ 00026 00027 namespace ASSA { 00028 00029 class Reactor; 00030 00038 class RemoteLogger : 00039 public Logger_Impl, 00040 public ASSA::ServiceHandler<ASSA::IPv4Socket> 00041 { 00042 public: 00043 RemoteLogger (); 00044 00047 virtual int open (); 00048 00051 virtual int handle_close (int fd_); 00052 00055 virtual int log_open (const char* appname_, 00056 const char* logfname_, 00057 u_long groups_, 00058 u_long maxsize_, 00059 Reactor* reactor_); 00060 00063 virtual int log_close (void); 00064 00066 virtual void log_resync (void); 00067 00068 virtual int log_msg (Group g_, size_t indent_level_, 00069 const string& func_name_, 00070 size_t expected_sz_, 00071 const char* fmt_, va_list); 00072 00073 virtual int log_func (Group g_, size_t indent_level_, 00074 const string& func_name_, 00075 marker_t type_); 00076 00077 private: 00078 RemoteLogger (const RemoteLogger&); 00079 RemoteLogger& operator= (const RemoteLogger&); 00080 00081 private: 00082 enum state_t { opened, closed }; 00083 enum msg_t { SIGN_ON = 0, SIGN_OFF, LOG_MSG }; 00084 00085 state_t m_state; 00086 Reactor* m_reactor; 00087 00089 bool m_recursive_call; 00090 }; 00091 00092 00093 } // @end namespace ASSA 00094 00095 #endif /* LOG_SERVER_H */ 00096