/home/vlg/develop/libASSA/libassa/assa/Logger.h File Reference

An abstraction to message logging facility. More...

#include <sys/types.h>
#include <string.h>
#include <stdio.h>
#include <string>
#include <stack>
#include "assa/Logger_Impl.h"
#include "assa/Singleton.h"
#include "assa/MemDump.h"

Include dependency graph for Logger.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  ASSA
namespace  ASSA::Log

Classes

class  ASSA::Logger
class  ASSA::DiagnosticContext
 Class DiagnosticContext tracks who deep a function is in the calling stack. More...

Defines

#define LOGGER   ASSA::Logger::get_instance()
 A shortcut to locate a singleton object of class Logger.
#define DL(X)
 A macro for writing debug message to the Logger.
#define EL(X)
 A macro for writing error message to the Logger.
#define trace(s)   ASSA::DiagnosticContext tRaCeR(s);
 trace() is used to trace function call chain in C++ program.
#define trace_with_mask(s, m)   ASSA::DiagnosticContext tRaCeR(s, m);
 trace_with_mask() is used to trace function call chain in C++ program.

Functions

void ASSA::Log::set_app_name (const std::string &appname_)
 Set application name.
int ASSA::Log::open_log_file (const char *logfname_, u_long groups_=ALL, u_long maxsize_=10485760)
 Open log file.
int ASSA::Log::open_log_stdout (u_long groups_=ALL)
 Write log message to standard output.
int ASSA::Log::open_log_server (const std::string &logsvraddr_, const char *logfname_, Reactor *reactor_, u_long groups_=ASSA::ALL, u_long maxsize_=10485760)
 Open connection with and write log message to the log server.
void ASSA::Log::log_resync (void)
 Resynchronize logging stream after Fork.
int ASSA::Log::log_close (void)
 Close logging stream.
void ASSA::Log::set_gmt_timezone (void)
 Set timezone to GMT.
void ASSA::Log::enable_timestamp (void)
 Enable timestamp logging.
void ASSA::Log::disable_timestamp (void)
 Disable timestamp logging.


Detailed Description

An abstraction to message logging facility.

Definition in file Logger.h.


Define Documentation

#define DL  ) 
 

Value:

do { \
       LOGGER->log_msg X; \
     } while (0)
A macro for writing debug message to the Logger.

Definition at line 273 of file Logger.h.

Referenced by ASSA::IPv4Socket::accept(), ASSA::Reactor::adjust_maxfdp1(), ASSA::CmdLineOpts::assign(), ASSA::Reactor::checkFDs(), ASSA::FdSet::clear(), ASSA::Socket::clear_fd_options(), ASSA::IPv4Socket::clone(), ASSA::IPv4Socket::close(), ASSA::IPv4Socket::connect(), ASSA::Reactor::dispatch(), ASSA::Reactor::dispatchHandler(), ASSA::Socketbuf::doallocate(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::doSync(), ASSA::IniFile::drop_pair(), ASSA::IniFile::drop_section(), ASSA::xdrIOBuffer::dump(), ASSA::TimerQueue::dump(), ASSA::Timer::dump(), ASSA::io_ptrs::dump(), ASSA::Semaphore::dump(), ASSA::PriorityQueue_STLPQ< T, Compare >::dump(), ASSA::PidFileLock::dump(), ASSA::MaskSet::dump(), ASSA::IniFile::dump(), ASSA::INETAddress::dump(), ASSA::FdSet::dump(), ASSA::CharInBuffer::dump(), ASSA::Address::dump(), ASSA::TimeVal::dump_to_log(), ASSA::MemDump::dump_to_log(), ASSA::Socket::dumpState(), ASSA::TimerQueue::expire(), ASSA::Fork::fork_exec(), ASSA::PidFileLock::get_lock_status(), ASSA::Socket::getBytesAvail(), ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >::handle_close(), ASSA::SIGUSR2Handler::handle_signal(), ASSA::SIGUSR1Handler::handle_signal(), ASSA::GenServer::handle_signal(), ASSA::ChildStatusHandler::handle_signal(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::handle_write(), ASSA::Reactor::handleError(), ASSA::SigHandler::in_range(), ASSA::SigHandlers::install(), ASSA::SigHandlersList::instance(), ASSA::Reactor::isAnyReady(), ASSA::Pipe::kill(), ASSA::IniFile::load(), ASSA::PidFileLock::lock(), ASSA::PidFileLock::lock_region(), ASSA::PidFileLock::lock_region_exclusive(), ASSA::Regexp::match(), ASSA::MemDump::MemDump(), ASSA::Pipe::open(), ASSA::IPv4Socket::open(), ASSA::operator>>(), ASSA::Regexp::Regexp(), ASSA::Reactor::registerIOHandler(), ASSA::Reactor::registerTimerHandler(), ASSA::TimerQueue::remove(), ASSA::SigHandlers::remove(), ASSA::Reactor::removeIOHandler(), ASSA::Reactor::removeTimerHandler(), ASSA::Socket::set_fd_options(), ASSA::IniFile::set_pair(), ASSA::Streambuf::setbuf(), ASSA::SigHandlers::sighandlers_dispatcher(), ASSA::Socketbuf::sys_read(), ASSA::Socketbuf::sys_write(), ASSA::PidFileLock::test_region(), ASSA::Socketbuf::underflow(), ASSA::PidFileLock::unlock_region(), ASSA::Reactor::waitForEvents(), ASSA::PidFileLock::write_pid(), ASSA::xdrIOBuffer::xdrIOBuffer(), ASSA::Streambuf::xsgetn(), ASSA::PidFileLock::~PidFileLock(), and ASSA::xdrIOBuffer::~xdrIOBuffer().

#define EL  ) 
 

Value:

do { \
       LOGGER->log_msg X; \
       LOGGER->log_msg(ASSA::ASSAERR,"errno: %d \"%s\"\n", errno, strerror(errno)); \
     } while (0)
A macro for writing error message to the Logger.

Definition at line 285 of file Logger.h.

Referenced by ASSA::IPv4Socket::accept(), ASSA::IPv4Socket::bind(), ASSA::Semaphore::close(), ASSA::IPv4Socket::connect(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::connect(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::connectServiceHandler(), ASSA::Semaphore::create(), ASSA::INETAddress::createHostPort(), ASSA::Reactor::dispatch(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::doSync(), ASSA::Fork::Fork(), ASSA::PidFileLock::get_lock_status(), ASSA::Socket::getBytesAvail(), ASSA::INETAddress::getHostName(), ASSA::Socket::getOption(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::handle_write(), ASSA::Reactor::handleError(), ASSA::SigHandlers::install(), ASSA::PidFileLock::log_error(), ASSA::Semaphore::op(), ASSA::Semaphore::open(), ASSA::Pipe::open(), ASSA::IPv4Socket::open(), ASSA::xdrIOBuffer::operator>>(), ASSA::operator>>(), ASSA::SigHandlers::remove(), ASSA::Semaphore::remove(), ASSA::Reactor::removeTimerHandler(), ASSA::Socket::setOption(), ASSA::IniFile::sync(), ASSA::Socket::turnOptionOff(), ASSA::Socket::turnOptionOn(), and ASSA::UNIXAddress::UNIXAddress().

#define LOGGER   ASSA::Logger::get_instance()
 

A shortcut to locate a singleton object of class Logger.

Definition at line 136 of file Logger.h.

Referenced by ASSA::DiagnosticContext::DiagnosticContext(), ASSA::Log::disable_timestamp(), ASSA::MemDump::dump_to_log(), ASSA::Log::enable_timestamp(), ASSA::Log::log_close(), ASSA::Log::log_resync(), ASSA::Log::open_log_file(), ASSA::Log::open_log_server(), ASSA::Log::open_log_stdout(), ASSA::Log::set_app_name(), ASSA::Log::set_gmt_timezone(), and ASSA::DiagnosticContext::~DiagnosticContext().

#define trace  )     ASSA::DiagnosticContext tRaCeR(s);
 

trace() is used to trace function call chain in C++ program.

trace() logs a message of type [function_name] --v-- with log level TRACE, where 'function_name' is the argument supplied. Upon exiting from the function, record [function_name] --^-- is written to the log file.

Application user can easily turn trace on/off by supplying different debug mask with {'-m', '--mask'} command-line argument and masking out highest bit in debug mask: TRACE

Definition at line 429 of file Logger.h.

Referenced by ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >::Acceptor(), ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >::acceptServiceHandler(), ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >::activateServiceHandler(), ASSA::Address::Address(), ASSA::UDPSocket::bind(), ASSA::UDPSocket::close(), ASSA::ServiceHandler< ASSA::IPv4Socket >::close(), ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >::close(), ASSA::ConUDPSocket::connect(), ASSA::ConUDPSocket::ConUDPSocket(), ASSA::TimerQueue::dump(), ASSA::PriorityQueue_STLPQ< T, Compare >::dump(), ASSA::Address::dump(), ASSA::TimeVal::dump_to_log(), ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >::handle_close(), ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >::handle_read(), ASSA::GenServer::handle_signal(), ASSA::TimerQueue::insert(), ASSA::PriorityQueue_STLPQ< T, Compare >::insert(), ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >::makeServiceHandler(), ASSA::IdSet::newid(), ASSA::UDPSocket::open(), ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >::open(), ASSA::PriorityQueue_STLPQ< T, Compare >::pop(), ASSA::PriorityQueue_Heap< T, Compare >::PriorityQueue_Heap(), ASSA::IdSet::recycle(), ASSA::PriorityQueue_STLPQ< T, Compare >::remove(), ASSA::ServiceHandler< ASSA::IPv4Socket >::ServiceHandler(), ASSA::Timer::Timer(), ASSA::TimerQueue::TimerQueue(), ASSA::PriorityQueue_STLPQ< T, Compare >::top(), ASSA::UDPSocket::UDPSocket(), ASSA::ConUDPSocket::unconnect(), ASSA::UNIXAddress::UNIXAddress(), ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >::~Acceptor(), ASSA::ConUDPSocket::~ConUDPSocket(), ASSA::PriorityQueue_STLPQ< T, Compare >::~PriorityQueue_STLPQ(), ASSA::ServiceHandler< ASSA::IPv4Socket >::~ServiceHandler(), ASSA::Timer::~Timer(), ASSA::UDPSocket::~UDPSocket(), and ASSA::UNIXAddress::~UNIXAddress().

#define trace_with_mask s,
 )     ASSA::DiagnosticContext tRaCeR(s, m);
 

trace_with_mask() is used to trace function call chain in C++ program.

Mask is used to limit the scope of the messages.

Definition at line 437 of file Logger.h.

Referenced by ASSA::IPv4Socket::accept(), ASSA::SigAction::action(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::activateServiceHandler(), ASSA::CmdLineOpts::add_flag_opt(), ASSA::CmdLineOpts::add_opt(), ASSA::Reactor::adjust_maxfdp1(), ASSA::CmdLineOpts::assign(), ASSA::Streambuf::base(), ASSA::SigHandlersList::begin(), ASSA::IPv4Socket::bind(), ASSA::Reactor::calculateTimeout(), ASSA::CFUNC_Handler::CFUNC_Handler(), ASSA::SigHandlersList::cfunc_handler(), ASSA::CharInBuffer::CharInBuffer(), ASSA::Reactor::checkFDs(), ASSA::Socket::clear_fd_options(), ASSA::IPv4Socket::clone(), ASSA::Semaphore::close(), ASSA::Pipe::close(), ASSA::IPv4Socket::close(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::close(), ASSA::CmdLineOpts::CmdLineOpts(), ASSA::Socket::connect(), ASSA::IPv4Socket::connect(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::connect(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::Connector(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::connectServiceHandler(), ASSA::xdrIOBuffer::copy(), ASSA::Semaphore::create(), ASSA::SigHandlers::dispatch(), ASSA::SigHandler::dispatch(), ASSA::Reactor::dispatch(), ASSA::Reactor::dispatchHandler(), ASSA::Streambuf::doallocate(), ASSA::Socketbuf::doallocate(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::doAsync(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::doSync(), ASSA::IniFile::drop_pair(), ASSA::IniFile::drop_section(), ASSA::xdrIOBuffer::dump(), ASSA::io_ptrs::dump(), ASSA::Semaphore::dump(), ASSA::PidFileLock::dump(), ASSA::IniFile::dump(), ASSA::Socket::dumpState(), ASSA::Streambuf::egptr(), ASSA::SigHandlersList::empty(), ASSA::SigHandlersList::end(), ASSA::Streambuf::epptr(), ASSA::SigHandlersList::erase(), ASSA::EventHandler::EventHandler(), ASSA::TimerQueue::expire(), ASSA::SigHandlersList::find(), ASSA::CmdLineOpts::find_option(), ASSA::SigAction::flags(), ASSA::Socketbuf::flush_output(), ASSA::fnode_t::fnode_t(), ASSA::Fork::Fork(), ASSA::Fork::fork_exec(), ASSA::ForkList::ForkList(), ASSA::CmdLineOpts::free_argv(), ASSA::PidFileLock::get_lock_status(), ASSA::Socket::getBytesAvail(), ASSA::Fork::getChildPID(), ASSA::Socket::getOption(), ASSA::fnode_t::getPID(), ASSA::Streambuf::gptr(), ASSA::EventHandler::handle_close(), ASSA::EventHandler::handle_except(), ASSA::EventHandler::handle_read(), ASSA::CFUNC_Handler::handle_signal(), ASSA::SIGPOLLHandler::handle_signal(), ASSA::SIGALRMHandler::handle_signal(), ASSA::SIGCHLDHandler::handle_signal(), ASSA::SIGUSR2Handler::handle_signal(), ASSA::SIGUSR1Handler::handle_signal(), ASSA::SIGINTHandler::handle_signal(), ASSA::ChildStatusHandler::handle_signal(), ASSA::EventHandler::handle_signal(), ASSA::EventHandler::handle_timeout(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::handle_timeout(), ASSA::EventHandler::handle_write(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::handle_write(), ASSA::Reactor::handleError(), ASSA::SigHandler::handler(), ASSA::SigAction::handler(), ASSA::Socket::ignore(), ASSA::Streambuf::in_avail(), ASSA::SigHandler::in_range(), ASSA::IniFile::IniFile(), ASSA::Streambuf::init(), ASSA::SigHandlersList::insert(), ASSA::SigHandlers::install(), ASSA::SigHandler::install(), ASSA::SigHandlersList::instance(), ASSA::IPv4Socket::IPv4Socket(), ASSA::CmdLineOpts::is_valid(), ASSA::Reactor::isAnyReady(), ASSA::Pipe::kill(), ASSA::IniFile::load(), ASSA::PidFileLock::lock(), ASSA::PidFileLock::lock_region(), ASSA::PidFileLock::lock_region_exclusive(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::makeServiceHandler(), ASSA::SigAction::mask(), ASSA::Regexp::match(), ASSA::fnode_t::needKill(), ASSA::Semaphore::op(), ASSA::Semaphore::open(), ASSA::Pipe::open(), ASSA::IPv4Socket::open(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::open(), ASSA::PidFileLock::open_pid_file(), ASSA::SigAction::operator SIGACTION *(), ASSA::xdrIOBuffer::operator void *(), ASSA::xdrIOBuffer::operator=(), ASSA::xdrIOBuffer::operator>>(), ASSA::operator>>(), ASSA::Option::Option(), ASSA::Streambuf::overflow(), ASSA::Socketbuf::overflow(), ASSA::CmdLineOpts::parse_args(), ASSA::CmdLineOpts::parse_config_file(), ASSA::Streambuf::pbase(), ASSA::Streambuf::pbump(), ASSA::PidFileLock::PidFileLock(), ASSA::Pipe::Pipe(), ASSA::Streambuf::pptr(), ASSA::Streambuf::pubsetbuf(), ASSA::Streambuf::pubsync(), ASSA::IPv4Socket::rdbuf(), ASSA::Reactor::Reactor(), ASSA::Socket::read(), ASSA::IPv4Socket::read(), ASSA::Regexp::Regexp(), ASSA::SigAction::register_action(), ASSA::Reactor::registerIOHandler(), ASSA::Reactor::registerTimerHandler(), ASSA::TimerQueue::remove(), ASSA::SigHandlers::remove(), ASSA::SigHandler::remove(), ASSA::Semaphore::remove(), ASSA::Reactor::removeHandler(), ASSA::Reactor::removeIOHandler(), ASSA::Reactor::removeTimerHandler(), ASSA::xdrIOBuffer::reset(), ASSA::SIGINTHandler::resetState(), ASSA::EventHandler::resetState(), ASSA::SigAction::restore_action(), ASSA::SigAction::retrieve_action(), ASSA::CmdLineOpts::rm_opt(), ASSA::Streambuf::sbumpc(), ASSA::SigHandlersList::seen_cfunc_handler(), ASSA::Semaphore::Semaphore(), ASSA::CmdLineOpts::set_error_none(), ASSA::Socket::set_fd_options(), ASSA::IniFile::set_pair(), ASSA::Streambuf::setb(), ASSA::Streambuf::setbuf(), ASSA::Streambuf::setg(), ASSA::Socket::setOption(), ASSA::Streambuf::setp(), ASSA::Streambuf::sgetc(), ASSA::Streambuf::sgetn(), ASSA::Streambuf::showmanyc(), ASSA::Socketbuf::showmanyc(), ASSA::SigAction::SigAction(), ASSA::SIGALRMHandler::SIGALRMHandler(), ASSA::SIGCHLDHandler::SIGCHLDHandler(), ASSA::SigHandlers::sighandlers_dispatcher(), ASSA::SigHandlersList::SigHandlersList(), ASSA::SIGINTHandler::SIGINTHandler(), ASSA::Semaphore::signal(), ASSA::SIGPOLLHandler::SIGPOLLHandler(), ASSA::SIGUSR1Handler::SIGUSR1Handler(), ASSA::SIGUSR2Handler::SIGUSR2Handler(), ASSA::SigHandlersList::size(), ASSA::Streambuf::snextc(), ASSA::Socket::Socket(), ASSA::Socketbuf::Socketbuf(), ASSA::Streambuf::sputc(), ASSA::Streambuf::sputn(), ASSA::Reactor::stopReactor(), ASSA::CmdLineOpts::str_to_argv(), ASSA::Streambuf::Streambuf(), ASSA::Streambuf::sync(), ASSA::Socketbuf::sync(), ASSA::IniFile::sync(), ASSA::Socketbuf::sys_read(), ASSA::Socketbuf::sys_write(), ASSA::PidFileLock::test_region(), ASSA::Socket::turnOptionOff(), ASSA::Socket::turnOptionOn(), ASSA::Streambuf::uflow(), ASSA::Streambuf::unbuffered(), ASSA::UnConUDPSocket::UnConUDPSocket(), ASSA::Streambuf::underflow(), ASSA::Socketbuf::underflow(), ASSA::PidFileLock::unlock_region(), ASSA::Semaphore::wait(), ASSA::Reactor::waitForEvents(), ASSA::Socket::write(), ASSA::IPv4Socket::write(), ASSA::PidFileLock::write_pid(), ASSA::xdrIOBuffer::xdrIOBuffer(), ASSA::Socketbuf::xput_char(), ASSA::Streambuf::xsgetn(), ASSA::Streambuf::xsputn(), ASSA::CmdLineOpts::~CmdLineOpts(), ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::~Connector(), ASSA::Fork::~Fork(), ASSA::ForkList::~ForkList(), ASSA::IniFile::~IniFile(), ASSA::IPv4Socket::~IPv4Socket(), ASSA::PidFileLock::~PidFileLock(), ASSA::Pipe::~Pipe(), ASSA::Reactor::~Reactor(), ASSA::Regexp::~Regexp(), ASSA::Semaphore::~Semaphore(), ASSA::SigHandlersList::~SigHandlersList(), ASSA::Socket::~Socket(), ASSA::Socketbuf::~Socketbuf(), ASSA::Streambuf::~Streambuf(), ASSA::TimerQueue::~TimerQueue(), ASSA::UnConUDPSocket::~UnConUDPSocket(), and ASSA::xdrIOBuffer::~xdrIOBuffer().


Generated on Sun Aug 13 15:08:08 2006 for libassa by  doxygen 1.4.6