libassa  3.5.1
RemoteLogger.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //------------------------------------------------------------------------------
3 // RemoteLogger.h
4 //------------------------------------------------------------------------------
5 // $Id: RemoteLogger.h,v 1.1 2003/07/25 02:51:47 vlg Exp $
6 //------------------------------------------------------------------------------
7 // Copyright (c) 2003 by Vladislav Grinchenko
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License
11 // as published by the Free Software Foundation; either version
12 // 2 of the License, or (at your option) any later version.
13 //------------------------------------------------------------------------------
14 // Created:
15 //------------------------------------------------------------------------------
16 #ifndef LOG_SERVER_H
17 #define LOG_SERVER_H
18 
19 #include "assa/ServiceHandler.h"
20 #include "assa/IPv4Socket.h"
21 #include "assa/Logger_Impl.h"
22 
23 /*******************************************************************************
24  Class
25 *******************************************************************************/
26 
27 namespace ASSA {
28 
29 class Reactor;
30 
38 class RemoteLogger :
39  public Logger_Impl,
40  public ASSA::ServiceHandler<ASSA::IPv4Socket>
41 {
42 public:
43  RemoteLogger ();
44 
47  virtual int open ();
48 
51  virtual int handle_close (int fd_);
52 
55  virtual int log_open (const char* appname_,
56  const char* logfname_,
57  u_long groups_,
58  u_long maxsize_,
59  Reactor* reactor_);
60 
63  virtual int log_close (void);
64 
66  virtual void log_resync (void);
67 
68  virtual int log_msg (Group g_, size_t indent_level_,
69  const string& func_name_,
70  size_t expected_sz_,
71  const char* fmt_, va_list);
72 
73  virtual int log_func (Group g_, size_t indent_level_,
74  const string& func_name_,
75  marker_t type_);
76 
77 private:
78  RemoteLogger (const RemoteLogger&);
80 
81 private:
82  enum state_t { opened, closed };
83  enum msg_t { SIGN_ON = 0, SIGN_OFF, LOG_MSG };
84 
87 
89  bool m_recursive_call;
90 };
91 
92 
93 } // @end namespace ASSA
94 
95 #endif /* LOG_SERVER_H */
96 
ASSA::RemoteLogger::log_func
virtual int log_func(Group g_, size_t indent_level_, const string &func_name_, marker_t type_)
Definition: RemoteLogger.cpp:175
ASSA::marker_t
marker_t
Definition: LogMask.h:67
ASSA::Group
Group
Definition: LogMask.h:25
ASSA::RemoteLogger::m_reactor
Reactor * m_reactor
Definition: RemoteLogger.h:88
ServiceHandler.h
ASSA::RemoteLogger::open
virtual int open()
Called by Connector upon establishing connection.
Definition: RemoteLogger.cpp:39
ASSA::ServiceHandler
Definition: ServiceHandler.h:31
ASSA::RemoteLogger::handle_close
virtual int handle_close(int fd_)
Called by Reactor when we close connection with log_close()
Definition: RemoteLogger.cpp:105
ASSA::RemoteLogger::opened
@ opened
Definition: RemoteLogger.h:84
u_long
unsigned long u_long
Definition: Logger_Impl.h:41
ASSA::RemoteLogger::RemoteLogger
RemoteLogger()
Definition: RemoteLogger.cpp:30
IPv4Socket.h
ASSA::Reactor
Definition: Reactor.h:57
ASSA::RemoteLogger::LOG_MSG
@ LOG_MSG
Definition: RemoteLogger.h:85
ASSA::RemoteLogger::log_resync
virtual void log_resync(void)
Flush output buffer.
Definition: RemoteLogger.cpp:114
ASSA::RemoteLogger::closed
@ closed
Definition: RemoteLogger.h:84
ASSA::RemoteLogger::SIGN_ON
@ SIGN_ON
Definition: RemoteLogger.h:85
ASSA::RemoteLogger::SIGN_OFF
@ SIGN_OFF
Definition: RemoteLogger.h:85
ASSA::RemoteLogger::log_msg
virtual int log_msg(Group g_, size_t indent_level_, const string &func_name_, size_t expected_sz_, const char *fmt_, va_list)
Definition: RemoteLogger.cpp:125
ASSA::RemoteLogger::log_open
virtual int log_open(const char *appname_, const char *logfname_, u_long groups_, u_long maxsize_, Reactor *reactor_)
Calling results into sending SIGN-ON message.
Definition: RemoteLogger.cpp:46
ASSA::RemoteLogger::state_t
state_t
Definition: RemoteLogger.h:84
ASSA::RemoteLogger::m_recursive_call
bool m_recursive_call
If true, recursive call is in progress.
Definition: RemoteLogger.h:91
ASSA::RemoteLogger::msg_t
msg_t
Definition: RemoteLogger.h:85
ASSA::RemoteLogger::log_close
virtual int log_close(void)
Close connection to the assa-logd.
Definition: RemoteLogger.cpp:89
ASSA
Definition: Acceptor.h:40
ASSA::RemoteLogger::operator=
RemoteLogger & operator=(const RemoteLogger &)
Logger_Impl.h
ASSA::RemoteLogger::m_state
state_t m_state
Definition: RemoteLogger.h:87
ASSA::RemoteLogger
Definition: RemoteLogger.h:40