00001 #ifndef ERIS_LOGSTREAM_H
00002 #define ERIS_LOGSTREAM_H
00003
00004 #include <Eris/Log.h>
00005
00006 #include <Atlas/Objects/ObjectsFwd.h>
00007
00008 #include <sstream>
00009
00010 namespace Atlas {
00011 namespace Message {
00012 class Element;
00013 }
00014 }
00015
00016 namespace Eris
00017 {
00018
00019 void doLog(LogLevel lvl, const std::string& msg);
00020
00021 class logStreamBase
00022 {
00023 public:
00024 std::ostream& operator<<(const std::string& s)
00025 {
00026 return m_stream << s;
00027 }
00028
00029
00030 protected:
00031
00032 std::ostringstream m_stream;
00033 };
00034
00035 class debug : public logStreamBase
00036 {
00037 public:
00038 ~debug()
00039 {
00040 m_stream << std::flush;
00041 doLog(LOG_DEBUG, m_stream.str());
00042 }
00043 };
00044
00045 class warning : public logStreamBase
00046 {
00047 public:
00048 ~warning()
00049 {
00050 m_stream << std::flush;
00051 doLog(LOG_WARNING, m_stream.str());
00052 }
00053 };
00054
00055 class error : public logStreamBase
00056 {
00057 public:
00058 ~error()
00059 {
00060 m_stream << std::flush;
00061 doLog(LOG_ERROR, m_stream.str());
00062 }
00063 };
00064
00065 std::ostream& operator<<(std::ostream& s, const Atlas::Objects::Root& obj);
00066 std::ostream& operator<<(std::ostream& s, const Atlas::Message::Element& msg);
00067
00068 }
00069
00070 #endif