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;
 
An ostream-like class that we'll use for logging. 
Definition: Console.hh:54
 
Message, error, warning, and logging functionality. 
Definition: Console.hh:51
 
void Prefix(const std::string &_lbl, const std::string &_file, unsigned int _line, int _color)
Print a prefix to both terminal and log file. 
Definition: Console.hh:86
 
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported. 
Definition: system_util.hh:48
 
ConsoleStream & operator<<(const T &_rhs)
Redirect whatever is passed in to both our ostream (if non-NULL) and the log file (if open)...
Definition: Console.hh:67
 
ConsoleStream(std::ostream *_stream)
Constructor. 
Definition: Console.hh:59
 
namespace for Simulation Description Format parser 
Definition: Console.hh:29
 
static Console * Instance()
Return an instance to this class.