WvStreams
|
00001 /* 00002 * A WvLogRcv example. 00003 * 00004 * Expected output: 00005 * logA<*1>: a message 00006 * logB<*2>: b message 00007 * logB<*2>: b message 00008 * logC<*3>: c message with extra newline 00009 * logC<*4>: c2 message 00010 * logA<Info>: a info message 00011 * logA<*1>: a normal message with [07][08] control chars 00012 * logA<*1>: a split 00013 * logB<*2>: message with stuff 00014 * logB<Info>: and other stuff. 00015 * logC<*3>: another split message. 00016 */ 00017 00018 #include "wvlogrcv.h" 00019 00020 int main() 00021 { 00022 WvLog a("logA", WvLog::Debug), b("logB", WvLog::Debug2); 00023 WvLog c("logC", WvLog::Debug3), c2 = c.split(WvLog::Debug4); 00024 00025 a("a message\n"); 00026 b("b message\n"); // prints twice -- once for rc, once for rc2 00027 c("c message with extra newline\n\n"); // extra newline discarded 00028 c2("c2 message\n"); 00029 00030 // the second line should be back at WvLog::Debug 00031 a(WvLog::Info, "a info message\n"); 00032 a("a normal message with \a\b control chars\r\n"); 00033 00034 // should display like this: 00035 // a split // message with stuff // and other stuff 00036 a("a split "); 00037 b("message "); 00038 b("with stuff "); 00039 b(WvLog::Info, "and other stuff.\n"); 00040 00041 // should display all on one line 00042 c("another split "); 00043 c2(WvLog::Debug3, "message."); 00044 00045 // should auto-terminate line on exit 00046 00047 return 0; 00048 }