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 
10 namespace Atlas {
11  namespace Message {
12  class Element;
13  }
14 }
15 
16 namespace Eris
17 {
18 
19 void doLog(LogLevel lvl, const std::string& msg);
20 
22 {
23 public:
24  std::ostream& operator<<(const std::string& s)
25  {
26  return m_stream << s;
27  }
28 
29 
30 protected:
31 
32  std::ostringstream m_stream;
33 };
34 
35 class notice : public logStreamBase
36 {
37 public:
38  ~notice()
39  {
40  m_stream << std::flush;
41  doLog(LOG_NOTICE, m_stream.str());
42  }
43 };
44 
45 class debug : public logStreamBase
46 {
47 public:
48  ~debug()
49  {
50  m_stream << std::flush;
51  doLog(LOG_DEBUG, m_stream.str());
52  }
53 };
54 
55 class warning : public logStreamBase
56 {
57 public:
58  ~warning()
59  {
60  m_stream << std::flush;
61  doLog(LOG_WARNING, m_stream.str());
62  }
63 };
64 
65 class error : public logStreamBase
66 {
67 public:
68  ~error()
69  {
70  m_stream << std::flush;
71  doLog(LOG_ERROR, m_stream.str());
72  }
73 };
74 
75 std::ostream& operator<<(std::ostream& s, const Atlas::Objects::Root& obj);
76 std::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