18 #ifndef _GAZEBO_CONSOLE_HH_
19 #define _GAZEBO_CONSOLE_HH_
26 #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829
27 # include <boost/thread.hpp>
40 #define gzmsg (gazebo::common::Console::msg())
43 #define gzdbg (gazebo::common::Console::dbg(__FILE__, __LINE__))
46 #define gzwarn (gazebo::common::Console::warn(__FILE__, __LINE__))
49 #define gzerr (gazebo::common::Console::err(__FILE__, __LINE__))
52 #define gzlog (gazebo::common::Console::log())
60 #define gzLogInit(_prefix, _str) \
61 (gazebo::common::Console::log.Init(_prefix, _str))
65 #define gzLogDirectory() (gazebo::common::Console::log.GetLogDirectory())
74 public:
FileLogger(
const std::string &_filename =
"");
84 public:
void Init(
const std::string &_prefix,
85 const std::string &_filename);
98 const std::string &_file,
int _line);
103 public: std::string GetLogDirectory()
const;
107 private:
static std::string GetMasterPort();
110 protected:
class Buffer :
public std::stringbuf
114 public:
Buffer(
const std::string &_filename);
117 public:
virtual ~
Buffer();
122 public:
virtual int sync();
130 private: std::string logDirectory;
151 public:
Logger(
const std::string &_prefix,
int _color, LogType _type);
154 public:
virtual ~
Logger();
158 public:
virtual Logger &operator()();
165 public:
virtual Logger &operator()(
166 const std::string &_file,
int _line);
169 protected:
class Buffer :
public std::stringbuf
178 public:
virtual ~
Buffer();
183 public:
virtual int sync();
198 private: std::string prefix;
208 public:
static void SetQuiet(
bool _q);
212 public:
static bool GetQuiet();
230 private:
static bool quiet;
Terminal logger.
Definition: Console.hh:135
LogType type
Destination type for the messages.
Definition: Console.hh:186
static Logger msg
Global instance of the message logger.
Definition: Console.hh:215
Output to stdout.
Definition: Console.hh:142
int color
ANSI color code using Select Graphic Rendition parameters (SGR).
Definition: Console.hh:191
static Logger dbg
Global instance of the debug logger.
Definition: Console.hh:221
String buffer for the base logger.
Definition: Console.hh:169
#define GZ_COMMON_VISIBLE
Definition: system.hh:84
Container for loggers, and global logging options (such as verbose vs.
Definition: Console.hh:204
std::ofstream * stream
Stream to output information into.
Definition: Console.hh:125
static FileLogger log
Global instance of the file logger.
Definition: Console.hh:227
A logger that outputs messages to a file.
Definition: Console.hh:69
static Logger err
Global instance of the error logger.
Definition: Console.hh:218
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
LogType
Definition: Console.hh:139
String buffer for the file logger.
Definition: Console.hh:110
static Logger warn
Global instance of the warning logger.
Definition: Console.hh:224
int color
Color for the output.
Definition: Console.hh:195