00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
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 }
00094
00095 #endif
00096