WvStreams
Docs
sgmlmanual
egfiles
wvlogex.cc
1
/*
2
* A WvLogRcv example.
3
*
4
* Expected output:
5
* logA<*1>: a message
6
* logB<*2>: b message
7
* logB<*2>: b message
8
* logC<*3>: c message with extra newline
9
* logC<*4>: c2 message
10
* logA<Info>: a info message
11
* logA<*1>: a normal message with [07][08] control chars
12
* logA<*1>: a split
13
* logB<*2>: message with stuff
14
* logB<Info>: and other stuff.
15
* logC<*3>: another split message.
16
*/
17
18
#include "wvlogrcv.h"
19
20
int
main()
21
{
22
WvLog
a(
"logA"
, WvLog::Debug), b(
"logB"
, WvLog::Debug2);
23
WvLog
c(
"logC"
, WvLog::Debug3), c2 = c.
split
(WvLog::Debug4);
24
25
a(
"a message\n"
);
26
b(
"b message\n"
);
// prints twice -- once for rc, once for rc2
27
c(
"c message with extra newline\n\n"
);
// extra newline discarded
28
c2(
"c2 message\n"
);
29
30
// the second line should be back at WvLog::Debug
31
a(WvLog::Info,
"a info message\n"
);
32
a(
"a normal message with \a\b control chars\r\n"
);
33
34
// should display like this:
35
// a split // message with stuff // and other stuff
36
a(
"a split "
);
37
b(
"message "
);
38
b(
"with stuff "
);
39
b(WvLog::Info,
"and other stuff.\n"
);
40
41
// should display all on one line
42
c(
"another split "
);
43
c2(WvLog::Debug3,
"message."
);
44
45
// should auto-terminate line on exit
46
47
return
0;
48
}
WvLog
A WvLog stream accepts log messages from applications and forwards them to all registered WvLogRcv's.
Definition:
wvlog.h:56
WvLog::split
WvLog split(LogLevel _loglevel) const
split off a new WvLog object with the requested loglevel.
Definition:
wvlog.h:142
Generated by
1.8.17