Go to the documentation of this file.
41 #ifndef __BASE_LOGGING_HH__
42 #define __BASE_LOGGING_HH__
98 if (str.length() && str.back() !=
'\n' && str.back() !=
'\r')
105 template<
typename ...Args>
void
108 std::stringstream
ss;
113 template<
typename ...Args>
void
129 virtual void log(
const Loc &loc, std::string
s) = 0;
136 #define base_message(logger, ...) \
137 logger.print(::Logger::Loc(__FILE__, __LINE__), __VA_ARGS__)
147 #define base_message_once(...) do { \
148 static bool once = false; \
150 base_message(__VA_ARGS__); \
155 #define exit_message(logger, ...) \
157 base_message(logger, __VA_ARGS__); \
158 logger.exit_helper(); \
171 #define panic(...) exit_message(::Logger::getPanic(), __VA_ARGS__)
183 #define fatal(...) exit_message(::Logger::getFatal(), __VA_ARGS__)
197 #define panic_if(cond, ...) \
200 panic("panic condition " # cond " occurred: %s", \
201 csprintf(__VA_ARGS__)); \
219 #define fatal_if(cond, ...) \
222 fatal("fatal condition " # cond " occurred: %s", \
223 csprintf(__VA_ARGS__)); \
239 #define warn(...) base_message(::Logger::getWarn(), __VA_ARGS__)
240 #define inform(...) base_message(::Logger::getInfo(), __VA_ARGS__)
241 #define hack(...) base_message(::Logger::getHack(), __VA_ARGS__)
243 #define warn_once(...) base_message_once(::Logger::getWarn(), __VA_ARGS__)
244 #define inform_once(...) base_message_once(::Logger::getInfo(), __VA_ARGS__)
245 #define hack_once(...) base_message_once(::Logger::getHack(), __VA_ARGS__)
263 #define warn_if(cond, ...) \
269 #define warn_if_once(cond, ...) \
272 warn_once(__VA_ARGS__); \
290 #define chatty_assert(cond, ...)
292 #define chatty_assert(cond, ...) \
295 panic("assert(" # cond ") failed: %s", csprintf(__VA_ARGS__)); \
299 #endif // __BASE_LOGGING_HH__
void exit_helper() M5_ATTR_NORETURN
This helper is necessary since noreturn isn't inherited by virtual functions, and gcc will get mad if...
virtual void log(const Loc &loc, std::string s)=0
Logger(const char *prefix)
Loc(const char *file, int line)
static void setLevel(LogLevel ll)
static Logger & getPanic()
Get a Logger for the specified type of message.
void print(const Loc &loc, const std::string &format, const Args &...args)
void print(const Loc &loc, const char *format, const Args &...args)
static Logger & getFatal()
void print(const Loc &loc, const std::string &str)
static Logger & getInfo()
void ccprintf(cp::Print &print)
Bitfield< 31, 29 > format
static Logger & getWarn()
static Logger & getHack()
Generated on Wed Sep 30 2020 14:02:07 for gem5 by doxygen 1.8.17