35 const char *_buf,
size_t len) = 0;
38 static void cleanup_on_fork(pid_t p);
39 static void static_init();
50 typedef wv::function<WvString(WvStringParm)> WvLogFilter;
78 static WvLogRcvBaseList *receivers;
79 static int num_receivers, num_logs;
85 WvLogFilter* filter = 0);
90 virtual bool isok()
const;
101 { loglevel = _loglevel;
return *
this; }
106 LogLevel l = loglevel;
107 size_t x = lvl(_loglevel).
write(filter ? (*filter)(s) : s);
113 size_t operator() (LogLevel _loglevel, WVSTRING_FORMAT_DECL)
115 LogLevel l = loglevel;
118 x = lvl(_loglevel).print((*filter)(
WvString(WVSTRING_FORMAT_CALL)));
120 x = lvl(_loglevel).print(WVSTRING_FORMAT_CALL);
130 {
return WvStream::operator()(filter ? (*filter)(s) : s); }
131 size_t operator() (WVSTRING_FORMAT_DECL)
133 WvStream::operator()((*filter)(
WvString(WVSTRING_FORMAT_CALL))) :
134 WvStream::operator()(WVSTRING_FORMAT_CALL) );
143 {
return WvLog(app, _loglevel, filter); }
149 virtual size_t uwrite(
const void *buf,
size_t len);
153 { print(
"%s: %s\n", s, strerror(errno)); }
156 const char *wstype()
const {
return "WvLog"; }
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
void perror(WvStringParm s)
a useful substitute for the normal C perror() function
virtual size_t write(const void *buf, size_t count)
Write data to the stream.
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
the data structure used by pre_select()/post_select() and internally by select(). ...
WvLog split(LogLevel _loglevel) const
split off a new WvLog object with the requested loglevel.
WvLog & lvl(LogLevel _loglevel)
change the loglevel.
WvString is an implementation of a simple and efficient printable-string class.
A WvLog stream accepts log messages from applications and forwards them to all registered WvLogRcv's...