diff options
Diffstat (limited to 'src/base/misc.cc')
-rw-r--r-- | src/base/misc.cc | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/src/base/misc.cc b/src/base/misc.cc index 2392d51fd..be97368f3 100644 --- a/src/base/misc.cc +++ b/src/base/misc.cc @@ -51,21 +51,6 @@ #include "base/types.hh" #include "sim/core.hh" - -Logger & -Logger::get(LogLevel ll) -{ - static std::array<Logger *, NUM_LOG_LEVELS> loggers{{ - new ExitLogger(std::cerr, "panic"), - new ExitLogger(std::cerr, "fatal"), - new Logger(std::cerr, "warn"), - new Logger(std::cerr, "info"), - new Logger(std::cerr, "hack"), - }}; - - return *loggers[ll]; -} - void Logger::setLevel(LogLevel ll) { @@ -104,6 +89,15 @@ Logger::printEpilogue(const char *func, const char *file, int line, } } +class ExitLogger : public Logger +{ + public: + using Logger::Logger; + + void printEpilogue(const char *func, const char *file, int line, + const char *format) override; +}; + void ExitLogger::printEpilogue(const char *func, const char *file, int line, const char *format) @@ -112,3 +106,17 @@ ExitLogger::printEpilogue(const char *func, const char *file, int line, ccprintf(stream, "Memory Usage: %ld KBytes\n", memUsage()); } + +Logger & +Logger::get(LogLevel ll) +{ + static std::array<Logger *, NUM_LOG_LEVELS> loggers{{ + new ExitLogger(std::cerr, "panic"), + new ExitLogger(std::cerr, "fatal"), + new Logger(std::cerr, "warn"), + new Logger(std::cerr, "info"), + new Logger(std::cerr, "hack"), + }}; + + return *loggers[ll]; +} |