|
gem5 [DEVELOP-FOR-25.0]
|
#include <logging.hh>
Classes | |
| struct | Loc |
Public Types | |
| enum | LogLevel { PANIC , FATAL , WARN , INFO , HACK , NUM_LOG_LEVELS } |
Public Member Functions | |
| Logger (const char *prefix) | |
| virtual | ~Logger () |
| template<typename ... Args> | |
| void | print (const Loc &loc, const char *format, const Args &...args) |
| template<typename ... Args> | |
| void | print (const Loc &loc, const std::string &format, const Args &...args) |
| void | exit_helper () |
| 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. | |
| void | registerExtraLog (std::function< std::string()> cb) |
| Register callback to generate extra log. | |
Static Public Member Functions | |
| static Logger & | getPanic () |
| Get a Logger for the specified type of message. | |
| static Logger & | getFatal () |
| static Logger & | getWarn () |
| static Logger & | getInfo () |
| static Logger & | getHack () |
| static void | setLevel (LogLevel ll) |
Protected Member Functions | |
| std::string | getFormattedExtraLog () const |
| Generate the formatted extra log string. | |
| virtual void | log (const Loc &loc, std::string s) |
| Generates the log message. | |
| virtual void | exit () |
Protected Attributes | |
| bool | enabled |
| const char * | prefix |
| std::vector< std::function< std::string()> > | extraLogs |
| Data structure to store extra log callbacks. | |
Definition at line 57 of file logging.hh.
| Enumerator | |
|---|---|
| PANIC | |
| FATAL | |
| WARN | |
| INFO | |
| HACK | |
| NUM_LOG_LEVELS | |
Definition at line 70 of file logging.hh.
|
inline |
|
inlinevirtual |
Definition at line 98 of file logging.hh.
|
inlineprotectedvirtual |
Definition at line 165 of file logging.hh.
Referenced by exit_helper().
|
inline |
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.
Definition at line 127 of file logging.hh.
References exit().
|
static |
Definition at line 84 of file logging_mock.cc.
Referenced by setLevel(), TEST(), and TEST_F().
|
inlineprotected |
Generate the formatted extra log string.
Developers can register extra logs when printing logs, such as PC of each CPUs, .etc. This function ensures that there's at least a new line between each extra log.
Definition at line 145 of file logging.hh.
References extraLogs, and gem5::ArmISA::ss.
Referenced by log().
|
static |
Definition at line 102 of file logging_mock.cc.
Referenced by setLevel(), TEST(), and TEST_F().
|
static |
Definition at line 96 of file logging_mock.cc.
Referenced by setLevel(), TEST(), and TEST_F().
|
static |
Get a Logger for the specified type of message.
Definition at line 78 of file logging_mock.cc.
Referenced by setLevel(), TEST(), and TEST_F().
|
static |
Definition at line 90 of file logging_mock.cc.
Referenced by setLevel(), TEST(), and TEST_F().
|
inlineprotectedvirtual |
Generates the log message.
By default it is sent to cerr.
Definition at line 159 of file logging.hh.
References gem5::Logger::Loc::file, getFormattedExtraLog(), gem5::Logger::Loc::line, and gem5::ArmISA::s.
Referenced by print().
|
inline |
Definition at line 101 of file logging.hh.
References gem5::ccprintf(), enabled, gem5::ArmISA::format, log(), prefix, and gem5::ArmISA::ss.
Referenced by print(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
|
inline |
Definition at line 117 of file logging.hh.
References gem5::ArmISA::format, and print().
|
inline |
Register callback to generate extra log.
Definition at line 131 of file logging.hh.
References extraLogs.
Referenced by TEST_F().
|
inlinestatic |
Definition at line 77 of file logging.hh.
References enabled, FATAL, getFatal(), getHack(), getInfo(), getPanic(), getWarn(), HACK, INFO, PANIC, and WARN.
Referenced by gem5::pybind_init_core(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
|
protected |
Definition at line 137 of file logging.hh.
Referenced by Logger(), print(), and setLevel().
|
protected |
Data structure to store extra log callbacks.
Definition at line 170 of file logging.hh.
Referenced by getFormattedExtraLog(), and registerExtraLog().
|
protected |
Definition at line 167 of file logging.hh.