libassa 3.5.1
|
#include <Logger.h>
Private Attributes | |
Logger_Impl * | m_impl |
stack< string > | m_context |
Logger implementation. | |
std::string | m_app_name |
Stack of all contexts. | |
Additional Inherited Members | |
![]() | |
static Logger * | get_instance () |
Return an instance of templated class T. | |
![]() | |
Singleton () | |
Protected Constructor. | |
virtual | ~Singleton () |
Virtual Destructor. | |
|
inline |
Definition at line 195 of file Logger.h.
References ASSA::Logger_Impl::disable_all_groups(), and m_impl.
Disable logging for group g_.
g_ | Group to disable |
Definition at line 152 of file Logger.h.
References ASSA::Logger_Impl::disable_group(), and m_impl.
Disable logging for groups_.
groups_ | Groups to disable |
Definition at line 170 of file Logger.h.
References ASSA::Logger_Impl::disable_groups(), and m_impl.
Definition at line 213 of file Logger.h.
References ASSA::Logger_Impl::disable_timestamp(), and m_impl.
Definition at line 186 of file Logger.h.
References ASSA::Logger_Impl::enable_all_groups(), and m_impl.
Enable logging for group g_.
g_ | Group to enable |
Definition at line 143 of file Logger.h.
References ASSA::Logger_Impl::enable_group(), and m_impl.
Enable logging for groups_.
groups_ | Groups to enable |
Definition at line 161 of file Logger.h.
References ASSA::Logger_Impl::enable_groups(), and m_impl.
Add optional timezone: GMT vs. Local.
Definition at line 204 of file Logger.h.
References ASSA::Logger_Impl::enable_timestamp(), and m_impl.
Definition at line 179 of file Logger.h.
References ASSA::Logger_Impl::group_enabled(), and m_impl.
Definition at line 38 of file Logger.cpp.
References ASSA::Logger_Impl::log_close(), and m_impl.
Referenced by ~Logger().
Definition at line 229 of file Logger.cpp.
References ASSA::Logger_Impl::log_func(), m_context, and m_impl.
Here is an interesting twist introduced by remote logging server:
Setting errno bits puts us in an unexpected situation. Asynchronous connection establishment reliest on examening errno to see if it was set by the system call, connect(), to EINPROGRESS. If it was, and thus connect() failed, IPv4Socket's connect() would log it as an error with EL() macro. When client is configured to log its messages to the server, call to EL() would result into the call to log_msg(), and because connection to the server has not yet been established, m_impl is set to 0 and errno is reset to EPERM. When stack unwinds itself, Connector's connect() fails because Connector's connectServiceHandler() returned errno different from expected EINPROGRESS (it is EPERM)! From vprintf(3S) manpage:
int vsnprintf (char* buf, size_t cnt, const char* fmt, va_list argptr);
"The vsnprintf() function returns the number of characters formatted, that is, then number of characters that would have been written to the buffer if it were large enough. It returns a negative value if an output error was encountered."
However, mingw relies on WIN32 implementation of the function which is inherently broken (not C99 compliant). From MSD reference:
"vsnprint returns the number of characters written if the the number of characters to write is less than or equal to 'cnt'; if the number of characters to write is greater than 'cnt', RETURN -1 indicating that output has been truncated. The return value does not include the terminating null, if one is written.
Estimate message size
Fromat and write message to the log
For extra debuggin
if (ret < 0) { va_start (ap, fmt_); vsnprintf (tmpbuf, TMPBUF_SZ -1, fmt_, ap); std::cout << "m_impl->log_msg()=-1 message:\n" << tmpbuf << std::flush; va_end (ap); }
Definition at line 143 of file Logger.cpp.
References ASSA::Logger_Impl::log_msg(), m_context, m_impl, and TMPBUF_SZ.
Write log messages to the logfile.
logfname_ | Name of the logfile |
groups_ | Logging masks enabled |
maxsize_ | Maximum size of the logfile |
Definition at line 65 of file Logger.cpp.
References ASSA::Logger_Impl::log_open(), and m_impl.
int Logger::log_open | ( | const std::string & | logsvr_, |
const char * | logfname_, | ||
u_long | groups_, | ||
u_long | maxsize_, | ||
Reactor * | reactor_ | ||
) |
Write log messages to the log server assa-logd.
logsvr_ | Address of assa-logd (assalogd@hostname) |
logfname_ | Name of the logfile |
groups_ | Logging masks enabled |
maxsize_ | Maximum size of the logfile |
reactor_ | Pointer to the Reactor to use for communication. |
Definition at line 76 of file Logger.cpp.
References ASSA::Logger_Impl::log_open(), m_app_name, and m_impl.
Write log messages to standard output.
Definition at line 52 of file Logger.cpp.
References ASSA::Logger_Impl::log_open(), and m_impl.
Definition at line 238 of file Logger.h.
References ASSA::Logger_Impl::log_resync(), and m_impl.
Set application name.
This should be the first call made to the newly created Logger object.
Definition at line 55 of file Logger.h.
References m_app_name.
0 - GMT, 1 - LOCAL
Definition at line 229 of file Logger.h.
References m_impl, and ASSA::Logger_Impl::set_timezone().
Definition at line 222 of file Logger.h.
References m_impl, and ASSA::Logger_Impl::timestamp_enabled().
|
private |
Stack of all contexts.
Definition at line 130 of file Logger.h.
Referenced by log_open(), and set_app_name().
|
private |
Logger implementation.
Definition at line 129 of file Logger.h.
Referenced by log_func(), log_msg(), sign_off(), and sign_on().
|
private |
Definition at line 128 of file Logger.h.
Referenced by disable_all_groups(), disable_group(), disable_groups(), disable_timestamp(), enable_all_groups(), enable_group(), enable_groups(), enable_timestamp(), group_enabled(), log_close(), log_func(), log_msg(), log_open(), log_open(), log_open(), log_resync(), set_timezone(), and timestamp_enabled().