eris 1.4.0
A WorldForge client library.
LogStream.h
1#ifndef ERIS_LOGSTREAM_H
2#define ERIS_LOGSTREAM_H
3
4#include "Log.h"
5
6#include <Atlas/Objects/ObjectsFwd.h>
7
8#include <sstream>
9
10namespace Atlas {
11 namespace Message {
12 class Element;
13 }
14}
15
16namespace Eris
17{
18
19void doLog(LogLevel lvl, const std::string& msg);
20
22{
23public:
24 std::ostream& operator<<(const std::string& s)
25 {
26 return m_stream << s;
27 }
28
29
30protected:
31
32 std::ostringstream m_stream;
33};
34
35class notice : public logStreamBase
36{
37public:
38 ~notice()
39 {
40 m_stream << std::flush;
41 doLog(LOG_NOTICE, m_stream.str());
42 }
43};
44
45class debug : public logStreamBase
46{
47public:
48 ~debug()
49 {
50 m_stream << std::flush;
51 doLog(LOG_DEBUG, m_stream.str());
52 }
53};
54
55class warning : public logStreamBase
56{
57public:
58 ~warning()
59 {
60 m_stream << std::flush;
61 doLog(LOG_WARNING, m_stream.str());
62 }
63};
64
65class error : public logStreamBase
66{
67public:
68 ~error()
69 {
70 m_stream << std::flush;
71 doLog(LOG_ERROR, m_stream.str());
72 }
73};
74
75std::ostream& operator<<(std::ostream& s, const Atlas::Objects::Root& obj);
76std::ostream& operator<<(std::ostream& s, const Atlas::Message::Element& msg);
77
78} // of namespace Eris
79
80#endif
Definition: Account.cpp:33
LogLevel
Definition: Log.h:12
@ LOG_DEBUG
excessive amounts of stuff
Definition: Log.h:17
@ LOG_WARNING
something is amiss, but probably okay to continue
Definition: Log.h:14
@ LOG_NOTICE
general information
Definition: Log.h:15
@ LOG_ERROR
serious failure indications
Definition: Log.h:13