18 #include <sys/types.h>
40 if (logfname_ == NULL || maxsize_ <= 0) {
118 size_t indent_level_,
119 const string& func_name_,
143 bool release =
false;
144 char* msgbuf_ptr =
format_msg (expected_sz_, fmt_, msg_list_, release);
145 if (msgbuf_ptr == NULL) {
154 delete [] msgbuf_ptr;
162 log_func (
Group g_,
size_t indent_level_,
const string& func_name_,
204 if (S_ISREG (fst.st_mode)) {
205 m_sink <<
"\nReached maximum allowable size\n"
213 unlink (newname.c_str ());
214 rename (
m_logfname.c_str (), newname.c_str ());
216 std::ios::app | std::ios::out);
222 else if (S_ISCHR (fst.st_mode)) {
241 char oldfill =
m_sink.fill (
'0');
242 m_sink << std::setw(8) << std::hex <<
m_groups <<
'\n' << std::dec;
245 <<
"m_tmflg = " <<
m_tmflg <<
'\n'
247 <<
"m_state = opened\n"
A collection of assert function wrappers.
#define Assure_exit(exp_)
Macro that makes program exit if assert fails.
Implemention of a Logger as a disk-based file.
Class TimeVal is a wrapper around UNIX timeval structure.
virtual int log_func(Group g_, size_t indent_level_, const string &func_name_, marker_t type_)
virtual int log_open(const char *logfname_, u_long groups_, u_long maxsize_=10485760)
Open File Logger.
virtual int log_close(void)
virtual int log_msg(Group g_, size_t indent_level_, const string &func_name_, size_t expected_sz_, const char *fmt_, va_list)
If output string is longer then LOGGER_MAXLINE-1, it is truncated to that size.
int log_raw_msg(const string &msg_)
Log message as it is (raw) without indentation or timestamping, but still perform byte counting and t...
char * format_msg(size_t expected_sz_, const char *fmt_, va_list vap_, bool &release_)
Format and put the message in the buffer.
virtual u_short indent_func_name(ostream &sink_, const string &funcname_, size_t indent_level_, marker_t type_)
bool group_enabled(Group g_) const
u_short m_indent_step
Indentation step.
u_long m_groups
Enabled groups.
string m_logfname
Log file name.
virtual u_short add_timestamp(ostream &sink_)
bool m_tmflg
Timestamp on/off flag.
Socket & flush(Socket &os_)
flush manipulator.
Socket & endl(Socket &os_)
endl manipulator.