libassa 3.5.1
|
#include <FileLogger.h>
Private Types | |
enum | state_t { opened , closed } |
Private Member Functions | |
FileLogger (const FileLogger &) | |
FileLogger & | operator= (const FileLogger &) |
int | handle_rollover () |
Private Attributes | |
std::ofstream | m_sink |
u_long | m_maxsize |
state_t | m_state |
u_long | m_bytecount |
Additional Inherited Members | |
![]() | |
static const unsigned int | LOGGER_MAXLINE = 6660 |
Maximum length of the formatted message. | |
![]() | |
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. | |
![]() | |
u_short | m_indent_step |
Indentation step. | |
u_long | m_groups |
Enabled groups. | |
string | m_logfname |
Log file name. | |
bool | m_tmflg |
Timestamp on/off flag. | |
int | m_tz |
Timezone: 0-GMT, 1-Local. | |
![]() | |
static char | m_msgbuf [LOGGER_MAXLINE] |
Static buffer for formatted message. | |
Definition at line 30 of file FileLogger.h.
|
private |
|
inline |
Definition at line 74 of file FileLogger.h.
|
private |
Definition at line 234 of file FileLogger.cpp.
References m_bytecount, ASSA::Logger_Impl::m_groups, ASSA::Logger_Impl::m_indent_step, ASSA::Logger_Impl::m_logfname, m_maxsize, m_sink, m_state, ASSA::Logger_Impl::m_tmflg, and opened.
|
private |
Definition at line 198 of file FileLogger.cpp.
References Assure_exit, closed, m_bytecount, ASSA::Logger_Impl::m_logfname, m_maxsize, m_sink, m_state, and opened.
Referenced by log_func(), log_msg(), and log_raw_msg().
Implements ASSA::Logger_Impl.
Definition at line 69 of file FileLogger.cpp.
References closed, m_bytecount, ASSA::Logger_Impl::m_groups, ASSA::Logger_Impl::m_logfname, m_maxsize, m_sink, and m_state.
|
virtual |
Implements ASSA::Logger_Impl.
Definition at line 161 of file FileLogger.cpp.
References ASSA::Logger_Impl::add_timestamp(), closed, ASSA::FUNC_ENTRY, ASSA::Logger_Impl::group_enabled(), handle_rollover(), ASSA::Logger_Impl::indent_func_name(), m_bytecount, m_sink, and m_state.
|
virtual |
If output string is longer then LOGGER_MAXLINE-1, it is truncated to that size.
From printf(3) manpage:
"Upon successful return, these functions return the number of characters printed (not including the trailing '\\0' used to end output to strings). If the output was truncated due to this limit then the return value is the number of characters (not including the trailing '\\0') which would have been written to the final string if enough space had been available. Thus, a return value of size or more means that the output was truncated. If an output error is encountered, a negative value is returned."
In other words, if you have attempted to write more then buffer can hold, the output is truncated by buffer size - 1, and the return value would be the number of bytes you have tried to write to the buffer.
If buffer size is 256, and you tried to write 340 bytes to it, the first 255 bytes are written to the buffer, and 340 is returns as the return value.
Implements ASSA::Logger_Impl.
Definition at line 116 of file FileLogger.cpp.
References ASSA::Logger_Impl::add_timestamp(), closed, ASSA::Logger_Impl::format_msg(), ASSA::FUNC_MSG, ASSA::Logger_Impl::group_enabled(), handle_rollover(), ASSA::Logger_Impl::indent_func_name(), m_bytecount, m_sink, and m_state.
|
virtual |
Open File Logger.
Reimplemented from ASSA::Logger_Impl.
Definition at line 32 of file FileLogger.cpp.
References ASSA::Logger_Impl::m_groups, ASSA::Logger_Impl::m_logfname, m_maxsize, m_sink, m_state, and opened.
Log message as it is (raw) without indentation or timestamping, but still perform byte counting and the logic associated with it.
Definition at line 183 of file FileLogger.cpp.
References closed, handle_rollover(), m_bytecount, m_sink, and m_state.
Reimplemented from ASSA::Logger_Impl.
Definition at line 84 of file FileLogger.h.
References m_sink.
|
private |
|
private |
Definition at line 71 of file FileLogger.h.
Referenced by dump(), handle_rollover(), log_close(), log_func(), log_msg(), and log_raw_msg().
|
private |
Definition at line 69 of file FileLogger.h.
Referenced by dump(), handle_rollover(), log_close(), and log_open().
|
private |
Definition at line 68 of file FileLogger.h.
Referenced by dump(), handle_rollover(), log_close(), log_func(), log_msg(), log_open(), log_raw_msg(), and log_resync().
|
private |
Definition at line 70 of file FileLogger.h.
Referenced by dump(), handle_rollover(), log_close(), log_func(), log_msg(), log_open(), and log_raw_msg().