libassa
3.5.1
|
#include <RemoteLogger.h>
Public Member Functions | |
RemoteLogger () | |
virtual int | open () |
Called by Connector upon establishing connection. More... | |
virtual int | handle_close (int fd_) |
Called by Reactor when we close connection with log_close() More... | |
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. More... | |
virtual int | log_close (void) |
Close connection to the assa-logd. More... | |
virtual void | log_resync (void) |
Flush output buffer. More... | |
virtual int | log_msg (Group g_, size_t indent_level_, const string &func_name_, size_t expected_sz_, const char *fmt_, va_list) |
virtual int | log_func (Group g_, size_t indent_level_, const string &func_name_, marker_t type_) |
![]() | |
Logger_Impl () | |
virtual | ~Logger_Impl () |
void | enable_group (Group g_) |
void | disable_group (Group g_) |
void | enable_groups (u_long g_) |
void | disable_groups (u_long g_) |
void | enable_all_groups (void) |
void | disable_all_groups (void) |
bool | group_enabled (Group g_) const |
void | enable_timestamp (void) |
void | disable_timestamp (void) |
bool | timestamp_enabled (void) const |
void | set_timezone (int zone_) |
void | set_indent_step (u_short step_) |
u_short | get_indent_step (void) const |
virtual int | log_open (u_long groups_) |
Open StdErr Logger. More... | |
virtual int | log_open (const char *logfname_, u_long groups_, u_long maxsize_) |
Open File Logger. More... | |
![]() | |
ServiceHandler () | |
Default constructor. More... | |
ServiceHandler (ASSA::IPv4Socket *ps_) | |
Constructor that takes PEER_STREAM as a parameter. More... | |
virtual | ~ServiceHandler () |
Destructor closes and deletes PEER_STREAM. More... | |
virtual void | close (void) |
Pure virtual method defined by subclass. More... | |
operator ASSA::IPv4Socket & () | |
Conversion operator to type PEER_STREAM &. More... | |
ASSA::IPv4Socket & | get_stream () |
Return referenct to underlying PEER_STREAM. More... | |
![]() | |
EventHandler () | |
Constructor. More... | |
virtual | ~EventHandler () |
Virtual destructor. More... | |
virtual int | handle_read (int fd) |
Read event callback. More... | |
virtual int | handle_write (int fd) |
Write handler callback. More... | |
virtual int | handle_except (int fd) |
Exception handler callback. More... | |
virtual int | handle_timeout (TimerId tid) |
Timeout handler callback. More... | |
virtual int | handle_signal (int signum_) |
Signal handler callback. More... | |
virtual void | resetState (void) |
A hook for derived class to reset internal state as needed. More... | |
void | set_id (const std::string &id_) |
Set EventHandler ID. More... | |
std::string | get_id () const |
Retrieve EventHandler ID. More... | |
Private Types | |
enum | state_t { opened , closed } |
enum | msg_t { SIGN_ON = 0 , SIGN_OFF , LOG_MSG } |
Private Member Functions | |
RemoteLogger (const RemoteLogger &) | |
RemoteLogger & | operator= (const RemoteLogger &) |
Private Attributes | |
state_t | m_state |
Reactor * | m_reactor |
bool | m_recursive_call |
If true, recursive call is in progress. More... | |
Additional Inherited Members | |
![]() | |
static const unsigned int | LOGGER_MAXLINE = 6660 |
Maximum length of the formatted message. More... | |
![]() | |
virtual u_short | add_timestamp (ostream &sink_) |
virtual u_short | indent_func_name (ostream &sink_, const string &funcname_, size_t indent_level_, marker_t type_) |
char * | format_msg (size_t expected_sz_, const char *fmt_, va_list vap_, bool &release_) |
Format and put the message in the buffer. More... | |
![]() | |
u_short | m_indent_step |
Indentation step. More... | |
u_long | m_groups |
Enabled groups. More... | |
string | m_logfname |
Log file name. More... | |
bool | m_tmflg |
Timestamp on/off flag. More... | |
int | m_tz |
Timezone: 0-GMT, 1-Local. More... | |
![]() | |
ASSA::IPv4Socket * | m_peerStream |
Concrete Socket instance. More... | |
![]() | |
std::string | m_id |
![]() | |
static char | m_msgbuf [LOGGER_MAXLINE] |
Static buffer for formatted message. More... | |
Definition at line 38 of file RemoteLogger.h.
|
private |
|
private |
RemoteLogger::RemoteLogger | ( | ) |
Definition at line 29 of file RemoteLogger.cpp.
|
private |
|
virtual |
Called by Reactor when we close connection with log_close()
Reimplemented from ASSA::EventHandler.
Definition at line 104 of file RemoteLogger.cpp.
References closed, ASSA::Logger_Impl::m_logfname, and m_state.
|
virtual |
Close connection to the assa-logd.
Send SIGN_OFF message to the log server and stop data processing. We are managed by Logger class.
Implements ASSA::Logger_Impl.
Definition at line 88 of file RemoteLogger.cpp.
References ASSA::flush(), ASSA::ServiceHandler< ASSA::IPv4Socket >::get_stream(), m_reactor, m_recursive_call, m_state, opened, ASSA::READ_EVENT, ASSA::Reactor::removeHandler(), and SIGN_OFF.
|
virtual |
Header + body (preamble;LOG_MSG;length;msg)
Implements ASSA::Logger_Impl.
Definition at line 174 of file RemoteLogger.cpp.
References ASSA::Logger_Impl::add_timestamp(), closed, ASSA::flush(), ASSA::FUNC_ENTRY, ASSA::ServiceHandler< ASSA::IPv4Socket >::get_stream(), ASSA::Logger_Impl::group_enabled(), ASSA::Logger_Impl::indent_func_name(), LOG_MSG, m_recursive_call, m_state, and ASSA::Socket::xdr_length().
|
virtual |
Header + body (preamble;LOG_MSG;length;msg)
Implements ASSA::Logger_Impl.
Definition at line 124 of file RemoteLogger.cpp.
References ASSA::Logger_Impl::add_timestamp(), Assure_exit, closed, ASSA::flush(), ASSA::Logger_Impl::format_msg(), ASSA::FUNC_MSG, ASSA::ServiceHandler< ASSA::IPv4Socket >::get_stream(), ASSA::Logger_Impl::group_enabled(), ASSA::Logger_Impl::indent_func_name(), LOG_MSG, m_recursive_call, m_state, and ASSA::Socket::xdr_length().
|
virtual |
Calling results into sending SIGN-ON message.
Put stream in a blocking mode. Otherwise, fast clients can override log server.
Send SIGN_ON message to the log server.
Header + Body
Reimplemented from ASSA::Logger_Impl.
Definition at line 45 of file RemoteLogger.cpp.
References ASSA::flush(), ASSA::ServiceHandler< ASSA::IPv4Socket >::get_stream(), ASSA::Logger_Impl::m_groups, ASSA::Logger_Impl::m_logfname, m_reactor, m_recursive_call, m_state, ASSA::Socket::nonblocking, opened, ASSA::READ_EVENT, ASSA::Reactor::registerIOHandler(), SIGN_ON, ASSA::Socket::turnOptionOff(), and ASSA::Socket::xdr_length().
|
virtual |
Flush output buffer.
Reimplemented from ASSA::Logger_Impl.
Definition at line 113 of file RemoteLogger.cpp.
References ASSA::flush(), ASSA::ServiceHandler< ASSA::IPv4Socket >::get_stream(), m_recursive_call, m_state, and opened.
|
virtual |
Called by Connector upon establishing connection.
Implements ASSA::ServiceHandler< ASSA::IPv4Socket >.
Definition at line 38 of file RemoteLogger.cpp.
|
private |
|
private |
Definition at line 86 of file RemoteLogger.h.
Referenced by log_close(), and log_open().
|
private |
If true, recursive call is in progress.
Definition at line 89 of file RemoteLogger.h.
Referenced by log_close(), log_func(), log_msg(), log_open(), and log_resync().
|
private |
Definition at line 85 of file RemoteLogger.h.
Referenced by handle_close(), log_close(), log_func(), log_msg(), log_open(), and log_resync().