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