29 std::vector< std::pair<Level, std::string> > log;
34 virtual void send(
Level level,
const std::string& msg)
36 log.push_back(make_pair(level, msg));
42 for (
size_t i = 0; i < log.size(); ++i)
43 std::cerr << log[i].first <<
" -> " << log[i].second <<
" <-" << std::endl;
69 o <<
"should eventually appear";
75 assert_eq(s.log[2].second,
"should eventually appear");
98 o <<
"should eventually appear";
120 o <<
"should eventually appear";
125 Test ostreamSender() {
129 std::ofstream
null(
"/dev/null", std::ios::out);
146 o <<
"should eventually appear";
Streambuf class for logging.
Definition: stream.h:35
Level
Urgency of a log message.
Definition: stream.h:12
@ WARN
Definition: stream.h:16
@ INFO
Definition: stream.h:14
Discard all messages.
Definition: file.h:11
Discard all messages.
Definition: null.h:11
virtual void send(Level level, const std::string &msg)
Log one line of text with the given level.
Definition: null.h:13
Discard all messages.
Definition: ostream.h:12
Handle sending a log message.
Definition: stream.h:23
void Test
Definition: test.h:178
#define assert_eq(x, y)
Definition: test.h:33
#define assert(x)
Definition: test.h:30