18#ifndef _SDF_CONSOLE_HH_
19#define _SDF_CONSOLE_HH_
32#pragma warning(disable: 4251)
41 #define sdfdbg (sdf::Console::Instance()->Log("Dbg", __FILE__, __LINE__))
44 #define sdfmsg (sdf::Console::Instance()->ColorMsg("Msg", \
45 __FILE__, __LINE__, 32))
48 #define sdfwarn (sdf::Console::Instance()->ColorMsg("Warning", \
49 __FILE__, __LINE__, 33))
52 #define sdferr (sdf::Console::Instance()->ColorMsg("Error", \
53 __FILE__, __LINE__, 31))
78 public:
template <
class T>
86 public:
void Prefix(
const std::string &_lbl,
87 const std::string &_file,
88 unsigned int _line,
int _color);
91 private: std::ostream *stream;
117 const std::string &file,
118 unsigned int line,
int color);
123 const std::string &file,
128 private: std::unique_ptr<ConsolePrivate> dataPtr;
154 *this->stream << _rhs;
std::ofstream logFileStream
logfile stream
Definition Console.hh:145
ConsolePrivate()
Constructor.
Definition Console.hh:136
Console::ConsoleStream logStream
log stream
Definition Console.hh:142
Console::ConsoleStream msgStream
message stream
Definition Console.hh:139
An ostream-like class that we'll use for logging.
Definition Console.hh:67
ConsoleStream & operator<<(const T &_rhs)
Redirect whatever is passed in to both our ostream (if non-NULL) and the log file (if open).
ConsoleStream(std::ostream *_stream)
Constructor.
Definition Console.hh:71
void Prefix(const std::string &_lbl, const std::string &_file, unsigned int _line, int _color)
Print a prefix to both terminal and log file.
static void Clear()
Clear out the current console to make room for a new one.
virtual ~Console()
Destructor.
static ConsolePtr Instance()
Return an instance to this class.
ConsoleStream & ColorMsg(const std::string &lbl, const std::string &file, unsigned int line, int color)
Use this to output a colored message to the terminal.
ConsoleStream & Log(const std::string &lbl, const std::string &file, unsigned int line)
Use this to output a message to a log file.
void SetQuiet(bool _q)
Set quiet output.
std::shared_ptr< Console > ConsolePtr
Definition Console.hh:60
namespace for Simulation Description Format parser
Definition Console.hh:36
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition system_util.hh:48