21#include "wvfdstream.h"
22#include "wvscatterhash.h"
32 WvLog::LogLevel max_level, last_level;
43 Src_Lvl(WvString _src,
int _lvl) : src(_src),
44 lvl((WvLog::LogLevel)_lvl) {};
47 DeclareWvScatterDict(
Src_Lvl, WvString, src);
49 Src_LvlDict custom_levels;
65 virtual void _mid_line(
const char *str,
size_t len) = 0;
69 {
if (!at_newline)
return;
_begin_line(); at_newline =
false; }
70 void mid_line(
const char *str,
size_t len)
72 if (len>0 && str[len-1] ==
'\n') at_newline =
true; }
75 virtual void log(WvStringParm source,
int loglevel,
76 const char *_buf,
size_t len);
78 static const char *loglevels[WvLog::NUM_LOGLEVELS];
80 WvLogRcv(WvLog::LogLevel _max_level = WvLog::NUM_LOGLEVELS);
84 {
if (at_newline)
return;
87 WvLog::LogLevel level()
const
89 void level(WvLog::LogLevel lvl)
99 bool set_custom_levels(WvString descr);
110 WvLogConsole(
int _fd,
111 WvLog::LogLevel _max_level = WvLog::NUM_LOGLEVELS);
112 virtual ~WvLogConsole();
Captures formatted log messages and outputs them to the specified file descriptor.
virtual void _mid_line(const char *str, size_t len)
add text to the current log line.
WvLogRcv adds some intelligence to WvLogRcvBase, to keep track of line-prefix-printing and other form...
virtual void _end_line()
End this (Guaranteed NonEmpty) log line.
virtual void _end_line()
End this (Guaranteed NonEmpty) log line.
virtual void _begin_line()
Start a new log line (print prefix).
virtual void _make_prefix(time_t now)
Set the Prefix and Prefix Length (size_t prelen).
virtual void _begin_line()
Start a new log line (print prefix).
virtual void _mid_line(const char *str, size_t len)=0
add text to the current log line.