18 #ifndef _SDF_CONSOLE_HH_
19 #define _SDF_CONSOLE_HH_
25 #include <boost/shared_ptr.hpp>
35 #define sdfdbg (sdf::Console::Instance()->Log("Dbg", \
39 #define sdfmsg (sdf::Console::Instance()->ColorMsg("Msg", \
40 __FILE__, __LINE__, 32))
43 #define sdfwarn (sdf::Console::Instance()->ColorMsg("Warning", \
44 __FILE__, __LINE__, 33))
47 #define sdferr (sdf::Console::Instance()->ColorMsg("Error", \
48 __FILE__, __LINE__, 31))
66 public:
template <
class T>
70 *this->stream << _rhs;
86 public:
void Prefix(
const std::string &_lbl,
87 const std::string &_file,
88 unsigned int _line,
int _color)
90 int index = _file.find_last_of(
"/") + 1;
94 *this->stream <<
"\033[1;" << _color <<
"m" << _lbl <<
" [" <<
95 _file.substr(index , _file.size() - index)<<
":" << _line <<
102 _file.substr(index , _file.size() - index)<<
":" << _line <<
"] ";
107 private: std::ostream *stream;
117 public:
static boost::shared_ptr<Console> Instance();
121 public:
void SetQuiet(
bool _q);
129 public: ConsoleStream &ColorMsg(
const std::string &lbl,
130 const std::string &file,
131 unsigned int line,
int color);
135 public: ConsoleStream &Log(
const std::string &lbl,
136 const std::string &file,
140 private: ConsoleStream msgStream;
143 private: ConsoleStream logStream;
146 private: std::ofstream logFileStream;
149 private:
static boost::shared_ptr<Console> myself;