6 #ifndef HPP_CENTROIDAL_DYNAMICS_LOGGER_HH 7 #define HPP_CENTROIDAL_DYNAMICS_LOGGER_HH 13 #include <Eigen/Dense> 18 #include "boost/assign.hpp" 26 #define LOGGER_VERBOSITY_ALL 28 #define SEND_MSG(msg, type) getLogger().sendMsg(msg, type, __FILE__, __LINE__) 30 #ifdef LOGGER_VERBOSITY_ERROR 31 #define SEND_DEBUG_MSG(msg) 32 #define SEND_INFO_MSG(msg) 33 #define SEND_WARNING_MSG(msg) 34 #define SEND_ERROR_MSG(msg) SEND_MSG(msg, MSG_TYPE_ERROR) 35 #define SEND_DEBUG_STREAM_MSG(msg) 36 #define SEND_INFO_STREAM_MSG(msg) 37 #define SEND_WARNING_STREAM_MSG(msg) 38 #define SEND_ERROR_STREAM_MSG(msg) SEND_MSG(msg, MSG_TYPE_ERROR_STREAM) 41 #ifdef LOGGER_VERBOSITY_WARNING_ERROR 42 #define SEND_DEBUG_MSG(msg) 43 #define SEND_INFO_MSG(msg) 44 #define SEND_WARNING_MSG(msg) SEND_MSG(msg, MSG_TYPE_WARNING) 45 #define SEND_ERROR_MSG(msg) SEND_MSG(msg, MSG_TYPE_ERROR) 46 #define SEND_DEBUG_STREAM_MSG(msg) 47 #define SEND_INFO_STREAM_MSG(msg) \ 48 #define SEND_WARNING_STREAM_MSG(msg) SEND_MSG(msg, MSG_TYPE_WARNING_STREAM) 49 #define SEND_ERROR_STREAM_MSG(msg) SEND_MSG(msg, MSG_TYPE_ERROR_STREAM) 52 #ifdef LOGGER_VERBOSITY_INFO_WARNING_ERROR 53 #define SEND_DEBUG_MSG(msg) 54 #define SEND_INFO_MSG(msg) SEND_MSG(msg, MSG_TYPE_INFO) 55 #define SEND_WARNING_MSG(msg) SEND_MSG(msg, MSG_TYPE_WARNING) 56 #define SEND_ERROR_MSG(msg) SEND_MSG(msg, MSG_TYPE_ERROR) 57 #define SEND_DEBUG_STREAM_MSG(msg) 58 #define SEND_INFO_STREAM_MSG(msg) SEND_MSG(msg, MSG_TYPE_INFO_STREAM) 59 #define SEND_WARNING_STREAM_MSG(msg) SEND_MSG(msg, MSG_TYPE_WARNING_STREAM) 60 #define SEND_ERROR_STREAM_MSG(msg) SEND_MSG(msg, MSG_TYPE_ERROR_STREAM) 63 #ifdef LOGGER_VERBOSITY_ALL 64 #define SEND_DEBUG_MSG(msg) SEND_MSG(msg, MSG_TYPE_DEBUG) 65 #define SEND_INFO_MSG(msg) SEND_MSG(msg, MSG_TYPE_INFO) 66 #define SEND_WARNING_MSG(msg) SEND_MSG(msg, MSG_TYPE_WARNING) 67 #define SEND_ERROR_MSG(msg) SEND_MSG(msg, MSG_TYPE_ERROR) 68 #define SEND_DEBUG_STREAM_MSG(msg) SEND_MSG(msg, MSG_TYPE_DEBUG_STREAM) 69 #define SEND_INFO_STREAM_MSG(msg) SEND_MSG(msg, MSG_TYPE_INFO_STREAM) 70 #define SEND_WARNING_STREAM_MSG(msg) SEND_MSG(msg, MSG_TYPE_WARNING_STREAM) 71 #define SEND_ERROR_STREAM_MSG(msg) SEND_MSG(msg, MSG_TYPE_ERROR_STREAM) 84 MSG_TYPE_ERROR_STREAM = 7
96 const std::string separator =
", ") {
98 for (
int i = 0; i < v.size() - 1; i++) ss << v[i] << separator;
99 ss << v[v.size() - 1];
103 template <
typename T,
int n>
104 std::string
toString(
const Eigen::MatrixBase<T>& v,
105 const std::string separator =
", ") {
106 if (v.rows() > v.cols())
return toString(v.transpose(), separator);
107 std::stringstream ss;
125 Logger(
double timeSample = 0.001,
double streamPrintPeriod = 1.0);
139 void sendMsg(std::string msg, MsgType type,
const char* file =
"",
144 bool setTimeSample(
double t);
147 bool setStreamPrintPeriod(
double s);
150 void setVerbosity(LoggerVerbosity lv);
190 #endif // HPP_CENTROIDAL_DYNAMICS_LOGGER_HH LoggerVerbosity m_lv
Definition: logger.hh:153
VERBOSITY_INFO_WARNING_ERROR
Definition: logger.hh:113
Definition: centroidal_dynamics.hh:14
Logger & getLogger()
Definition: logger.cpp:22
double m_timeSample
verbosity of the logger
Definition: logger.hh:154
~Logger()
Definition: logger.hh:128
bool isErrorMsg(MsgType m)
Definition: logger.hh:180
VERBOSITY_ALL
Definition: logger.hh:113
MSG_TYPE_WARNING_STREAM
Definition: logger.hh:83
double m_streamPrintPeriod
specify the period of call of the countdown method
Definition: logger.hh:155
double m_printCountdown
specify the time period of the stream prints
Definition: logger.hh:156
bool isWarningMsg(MsgType m)
Definition: logger.hh:176
#define CENTROIDAL_DYNAMICS_DLLAPI
Definition: local_config.hh:52
MSG_TYPE_DEBUG_STREAM
Definition: logger.hh:81
bool isStreamMsg(MsgType m)
Definition: logger.hh:163
bool isDebugMsg(MsgType m)
Definition: logger.hh:168
MSG_TYPE_INFO
Definition: logger.hh:78
MSG_TYPE_DEBUG
Definition: logger.hh:77
MSG_TYPE_ERROR
Definition: logger.hh:80
MSG_TYPE_WARNING
Definition: logger.hh:79
VERBOSITY_ERROR
Definition: logger.hh:113
MSG_TYPE_INFO_STREAM
Definition: logger.hh:82
std::map< std::string, double > m_stream_msg_counters
Definition: logger.hh:161
bool isInfoMsg(MsgType m)
Definition: logger.hh:172
VERBOSITY_WARNING_ERROR
Definition: logger.hh:113
Definition: logger.hh:122
std::string toString(const T &v)
Definition: logger.hh:88