gem5 v24.0.0.0
Loading...
Searching...
No Matches
gem5::Logger Class Reference

#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.
 

Static Public Member Functions

static LoggergetPanic ()
 Get a Logger for the specified type of message.
 
static LoggergetFatal ()
 
static LoggergetWarn ()
 
static LoggergetInfo ()
 
static LoggergetHack ()
 
static void setLevel (LogLevel ll)
 

Protected Member Functions

virtual void log (const Loc &loc, std::string s)
 Generates the log message.
 
virtual void exit ()
 

Protected Attributes

bool enabled
 
const char * prefix
 

Detailed Description

Definition at line 54 of file logging.hh.

Member Enumeration Documentation

◆ LogLevel

Enumerator
PANIC 
FATAL 
WARN 
INFO 
HACK 
NUM_LOG_LEVELS 

Definition at line 67 of file logging.hh.

Constructor & Destructor Documentation

◆ Logger()

gem5::Logger::Logger ( const char * prefix)
inline

Definition at line 90 of file logging.hh.

References prefix.

Referenced by TEST_F().

◆ ~Logger()

virtual gem5::Logger::~Logger ( )
inlinevirtual

Definition at line 95 of file logging.hh.

Member Function Documentation

◆ exit()

virtual void gem5::Logger::exit ( )
inlineprotectedvirtual

Definition at line 136 of file logging.hh.

Referenced by exit_helper().

◆ exit_helper()

void gem5::Logger::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 124 of file logging.hh.

References exit().

◆ getFatal()

Logger & gem5::Logger::getFatal ( )
static

Definition at line 84 of file logging_mock.cc.

Referenced by setLevel(), TEST(), and TEST_F().

◆ getHack()

Logger & gem5::Logger::getHack ( )
static

Definition at line 102 of file logging_mock.cc.

Referenced by setLevel(), TEST(), and TEST_F().

◆ getInfo()

Logger & gem5::Logger::getInfo ( )
static

Definition at line 96 of file logging_mock.cc.

Referenced by setLevel(), TEST(), and TEST_F().

◆ getPanic()

Logger & gem5::Logger::getPanic ( )
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().

◆ getWarn()

Logger & gem5::Logger::getWarn ( )
static

Definition at line 90 of file logging_mock.cc.

Referenced by setLevel(), TEST(), and TEST_F().

◆ log()

virtual void gem5::Logger::log ( const Loc & loc,
std::string s )
inlineprotectedvirtual

Generates the log message.

By default it is sent to cerr.

Definition at line 131 of file logging.hh.

References gem5::Logger::Loc::file, gem5::Logger::Loc::line, and gem5::ArmISA::s.

Referenced by print().

◆ print() [1/2]

template<typename ... Args>
void gem5::Logger::print ( const Loc & loc,
const char * format,
const Args &... args )
inline

◆ print() [2/2]

template<typename ... Args>
void gem5::Logger::print ( const Loc & loc,
const std::string & format,
const Args &... args )
inline

Definition at line 114 of file logging.hh.

References gem5::ArmISA::format, and print().

◆ setLevel()

static void gem5::Logger::setLevel ( LogLevel ll)
inlinestatic

Member Data Documentation

◆ enabled

bool gem5::Logger::enabled
protected

Definition at line 127 of file logging.hh.

Referenced by print(), and setLevel().

◆ prefix

const char* gem5::Logger::prefix
protected

Definition at line 138 of file logging.hh.

Referenced by Logger(), and print().


The documentation for this class was generated from the following files:

Generated on Tue Jun 18 2024 16:24:12 for gem5 by doxygen 1.11.0