Hoa Nguyen has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/33076 )
Change subject: base: Tag API methods and macros in logger.hh
......................................................................
base: Tag API methods and macros in logger.hh
Change-Id: I36c4d39eb26fc3af1683ec648df91d6055be97ba
Signed-off-by: Hoa Nguyen <[email protected]>
---
M src/base/logging.hh
1 file changed, 57 insertions(+), 4 deletions(-)
diff --git a/src/base/logging.hh b/src/base/logging.hh
index 0c4265b..0c46bf6 100644
--- a/src/base/logging.hh
+++ b/src/base/logging.hh
@@ -52,18 +52,30 @@
{
public:
- // Get a Logger for the specified type of message.
+ /**
+ * Get a Logger for the specified type of message.
+ *
+ * @ingroup api_logger
+ * @{
+ */
static Logger &getPanic();
static Logger &getFatal();
static Logger &getWarn();
static Logger &getInfo();
static Logger &getHack();
+ /** @} */ // end of api_logger
+ /**
+ * @ingroup api_logger
+ */
enum LogLevel {
PANIC, FATAL, WARN, INFO, HACK,
NUM_LOG_LEVELS,
};
+ /**
+ * @ingroup api_logger
+ */
static void
setLevel(LogLevel ll)
{
@@ -81,13 +93,22 @@
int line;
};
+ /**
+ * @ingroup api_logger
+ */
Logger(const char *prefix) : enabled(true), prefix(prefix)
{
assert(prefix);
}
+ /**
+ * @ingroup api_logger
+ */
virtual ~Logger() {};
+ /**
+ * @ingroup api_logger
+ */
void
print(const Loc &loc, const std::string &str)
{
@@ -100,6 +121,9 @@
log(loc, ss.str());
}
+ /**
+ * @ingroup api_logger
+ */
template<typename ...Args> void
print(const Loc &loc, const char *format, const Args &...args)
{
@@ -108,15 +132,22 @@
print(loc, ss.str());
}
+ /**
+ * @ingroup api_logger
+ */
template<typename ...Args> void
print(const Loc &loc, const std::string &format, const Args &...args)
{
print(loc, format.c_str(), args...);
}
- // This helper is necessary since noreturn isn't inherited by virtual
- // functions, and gcc will get mad if a function calls panic and then
- // doesn't return.
+ /**
+ * This helper is necessary since noreturn isn't inherited by virtual
+ * functions, and gcc will get mad if a function calls panic and then
+ * doesn't return.
+ *
+ * @ingroup api_logger
+ */
void exit_helper() M5_ATTR_NORETURN { exit(); ::abort(); }
protected:
@@ -159,6 +190,8 @@
* be called when something happens that should never ever happen
* regardless of what the user does (i.e., an acutal m5 bug). panic()
* might call abort which can dump core or enter the debugger.
+ *
+ * @ingroup api_logger
*/
#define panic(...) exit_message(::Logger::getPanic(), __VA_ARGS__)
@@ -167,6 +200,8 @@
* be called when the simulation cannot continue due to some condition
* that is the user's fault (bad configuration, invalid arguments,
* etc.) and not a simulator bug. fatal() might call exit, unlike panic().
+ *
+ * @ingroup api_logger
*/
#define fatal(...) exit_message(::Logger::getFatal(), __VA_ARGS__)
@@ -177,6 +212,8 @@
*
* @param cond Condition that is checked; if true -> panic
* @param ... Printf-based format string with arguments, extends printout.
+ *
+ * @ingroup api_logger
*/
#define panic_if(cond, ...) \
do { \
@@ -195,6 +232,8 @@
*
* @param cond Condition that is checked; if true -> fatal
* @param ... Printf-based format string with arguments, extends printout.
+ *
+ * @ingroup api_logger
*/
#define fatal_if(cond, ...) \
do { \
@@ -205,6 +244,9 @@
} while (0)
+/**
+ * @ingroup api_logger
+ */
#define warn(...) base_message(::Logger::getWarn(), __VA_ARGS__)
#define inform(...) base_message(::Logger::getInfo(), __VA_ARGS__)
#define hack(...) base_message(::Logger::getHack(), __VA_ARGS__)
@@ -212,6 +254,7 @@
#define warn_once(...) base_message_once(::Logger::getWarn(), __VA_ARGS__)
#define inform_once(...) base_message_once(::Logger::getInfo(),
__VA_ARGS__)
#define hack_once(...) base_message_once(::Logger::getHack(), __VA_ARGS__)
+/** @} */ // end of api_logger
/**
* Conditional warning macro that checks the supplied condition and
@@ -220,6 +263,9 @@
*
* @param cond Condition that is checked; if true -> warn
* @param ... Printf-based format string with arguments, extends printout.
+ *
+ * @ingroup api_logger
+ * @{
*/
#define warn_if(cond, ...) \
do { \
@@ -232,6 +278,7 @@
if ((cond)) \
warn_once(__VA_ARGS__); \
} while (0)
+/** @} */ // end of api_logger
/**
* The chatty assert macro will function like a normal assert, but will
allow
@@ -241,10 +288,16 @@
*
* @param cond Condition that is checked; if false -> assert
* @param ... Printf-based format string with arguments, extends printout.
+ *
+ * @ingroup api_logger
*/
#ifdef NDEBUG
#define chatty_assert(cond, ...)
#else //!NDEBUG
+
+/**
+ * @ingroup api_logger
+ */
#define chatty_assert(cond, ...) \
do { \
if (!(cond)) \
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/33076
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I36c4d39eb26fc3af1683ec648df91d6055be97ba
Gerrit-Change-Number: 33076
Gerrit-PatchSet: 1
Gerrit-Owner: Hoa Nguyen <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s