18#ifndef SDF_CONSOLE_HH_
19#define SDF_CONSOLE_HH_
33#pragma warning(disable: 4251)
39 inline namespace SDF_VERSION_NAMESPACE {
46 #define sdfdbg (sdf::Console::Instance()->Log("Dbg", __FILE__, __LINE__))
49 #define sdfmsg (sdf::Console::Instance()->ColorMsg("Msg", \
50 __FILE__, __LINE__, 32))
53 #define sdfwarn (sdf::Console::Instance()->ColorMsg("Warning", \
54 __FILE__, __LINE__, 33))
57 #define sdferr (sdf::Console::Instance()->ColorMsg("Error", \
58 __FILE__, __LINE__, 31))
83 public:
template <
class T>
91 public:
void Prefix(
const std::string &_lbl,
92 const std::string &_file,
93 unsigned int _line,
int _color);
106 private: std::ostream *stream;
132 const std::string &file,
133 unsigned int line,
int color);
141 const std::string &file,
158 private: std::unique_ptr<ConsolePrivate> dataPtr;
184 *this->stream << _rhs;
Definition: Console.hh:164
An ostream-like class that we'll use for logging.
Definition: Console.hh:72
Message, error, warning, and logging functionality.
Definition: Console.hh:69
std::ofstream logFileStream
logfile stream
Definition: Console.hh:175
void SetQuiet(bool _q)
Set quiet output.
Console::ConsoleStream msgStream
message stream
Definition: Console.hh:169
void Prefix(const std::string &_lbl, const std::string &_file, unsigned int _line, int _color)
Print a prefix to both terminal and log file.
ConsoleStream & Log(const std::string &lbl, const std::string &file, unsigned int line)
Use this to output a message to a log file at $HOME/.sdformat/sdformat.log.
ConsoleStream & operator<<(const T &_rhs)
Redirect whatever is passed in to both our ostream (if non-NULL) and the log file (if open).
ConsolePrivate()
Constructor.
Definition: Console.hh:166
ConsoleStream & GetMsgStream()
Get the current message stream object.
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.
std::shared_ptr< Console > ConsolePtr
Definition: Console.hh:65
virtual ~Console()
Destructor.
ConsoleStream & GetLogStream()
Get the current log stream object.
static void Clear()
Clear out the current console to make room for a new one.
static ConsolePtr Instance()
Return an instance to this class.
ConsoleStream(std::ostream *_stream)
Constructor.
Definition: Console.hh:76
std::ostream * GetStream()
Get the current stream object.
void SetStream(std::ostream *_stream)
Set the stream object.
Console::ConsoleStream logStream
log stream
Definition: Console.hh:172
namespace for Simulation Description Format parser
Definition: Actor.hh:35
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:25