Go to the documentation of this file.
18 #ifndef SDF_CONSOLE_HH_
19 #define SDF_CONSOLE_HH_
26 #include <sdf/sdf_config.h>
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);
99 public:
void SetStream(std::ostream *_stream);
103 public: std::ostream *GetStream();
106 private: std::ostream *stream;
119 public:
static void Clear();
123 public:
void SetQuiet(
bool _q);
131 public: ConsoleStream &ColorMsg(
const std::string &lbl,
132 const std::string &file,
133 unsigned int line,
int color);
137 public: ConsoleStream &Log(
const std::string &lbl,
138 const std::string &file,
145 public: ConsoleStream &GetMsgStream();
151 public: ConsoleStream &GetLogStream();
155 private: std::unique_ptr<ConsolePrivate> dataPtr;
181 *this->stream << _rhs;
184 if (Console::Instance()->dataPtr->logFileStream.is_open())
186 Console::Instance()->dataPtr->logFileStream << _rhs;
187 Console::Instance()->dataPtr->logFileStream.flush();
Console::ConsoleStream logStream
log stream
Definition: Console.hh:169
namespace for Simulation Description Format parser
Definition: Actor.hh:32
std::ostream & operator<<(std::ostream &os, ParamStreamer< T > s)
Definition: Param.hh:75
Console::ConsoleStream msgStream
message stream
Definition: Console.hh:166
An ostream-like class that we'll use for logging.
Definition: Console.hh:71
Message, error, warning, and logging functionality.
Definition: Console.hh:68
Definition: Console.hh:160
#define SDFORMAT_VISIBLE
Definition: system_util.hh:48
std::shared_ptr< Console > ConsolePtr
Definition: Console.hh:65
ConsoleStream(std::ostream *_stream)
Constructor.
Definition: Console.hh:76
ConsolePrivate()
Constructor.
Definition: Console.hh:163
std::ofstream logFileStream
logfile stream
Definition: Console.hh:172