18 #ifndef _SDF_CONSOLE_HH_
19 #define _SDF_CONSOLE_HH_
25 #include <boost/shared_ptr.hpp>
33 #define sdfdbg (sdf::Console::Instance()->Log("Dbg", \
37 #define sdfmsg (sdf::Console::Instance()->ColorMsg("Msg", \
38 __FILE__, __LINE__, 32))
41 #define sdfwarn (sdf::Console::Instance()->ColorMsg("Warning", \
42 __FILE__, __LINE__, 33))
45 #define sdferr (sdf::Console::Instance()->ColorMsg("Error", \
46 __FILE__, __LINE__, 31))
64 public:
template <
class T>
68 *this->stream << _rhs;
81 public:
void Prefix(
const std::string &_lbl,
82 const std::string &_file,
83 unsigned int _line,
int _color)
85 int index = _file.find_last_of(
"/") + 1;
89 *this->stream <<
"\033[1;" << _color <<
"m" << _lbl <<
" [" <<
90 _file.substr(index , _file.size() - index)<<
":" << _line <<
97 _file.substr(index , _file.size() - index)<<
":" << _line <<
"] ";
102 private: std::ostream *stream;
112 public:
static boost::shared_ptr<Console>
Instance();
124 public: ConsoleStream &
ColorMsg(
const std::string &lbl,
125 const std::string &file,
126 unsigned int line,
int color);
130 public: ConsoleStream &
Log(
const std::string &lbl,
131 const std::string &file,
135 private: ConsoleStream msgStream;
138 private: ConsoleStream logStream;
141 private: std::ofstream logFileStream;
144 private:
static boost::shared_ptr<Console> myself;