gem5  v20.1.0.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Logger Class Referenceabstract

#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 ()
 
void print (const Loc &loc, const std::string &str)
 
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 () M5_ATTR_NORETURN
 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. More...
 

Static Public Member Functions

static LoggergetPanic ()
 Get a Logger for the specified type of message. More...
 
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)=0
 
virtual void exit ()
 

Protected Attributes

bool enabled
 
const char * prefix
 

Detailed Description

Definition at line 51 of file logging.hh.

Member Enumeration Documentation

◆ LogLevel

Enumerator
PANIC 
FATAL 
WARN 
INFO 
HACK 
NUM_LOG_LEVELS 

Definition at line 64 of file logging.hh.

Constructor & Destructor Documentation

◆ Logger()

Logger::Logger ( const char *  prefix)
inline

Definition at line 86 of file logging.hh.

References prefix.

◆ ~Logger()

virtual Logger::~Logger ( )
inlinevirtual

Definition at line 91 of file logging.hh.

Member Function Documentation

◆ exit()

virtual void Logger::exit ( )
inlineprotectedvirtual

Definition at line 130 of file logging.hh.

Referenced by exit_helper().

◆ exit_helper()

void 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 & Logger::getFatal ( )
static

Definition at line 79 of file logging.cc.

Referenced by setLevel().

◆ getHack()

Logger & Logger::getHack ( )
static

Definition at line 82 of file logging.cc.

Referenced by setLevel().

◆ getInfo()

Logger & Logger::getInfo ( )
static

Definition at line 81 of file logging.cc.

Referenced by setLevel().

◆ getPanic()

Logger & Logger::getPanic ( )
static

Get a Logger for the specified type of message.

Definition at line 78 of file logging.cc.

Referenced by setLevel().

◆ getWarn()

Logger & Logger::getWarn ( )
static

Definition at line 80 of file logging.cc.

Referenced by setLevel().

◆ log()

virtual void Logger::log ( const Loc loc,
std::string  s 
)
protectedpure virtual

Referenced by print().

◆ print() [1/3]

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

Definition at line 106 of file logging.hh.

References ccprintf(), ArmISA::format, print(), and ArmISA::ss.

◆ print() [2/3]

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

Definition at line 114 of file logging.hh.

References ArmISA::format, and print().

◆ print() [3/3]

void Logger::print ( const Loc loc,
const std::string &  str 
)
inline

Definition at line 94 of file logging.hh.

References enabled, log(), prefix, and ArmISA::ss.

Referenced by print().

◆ setLevel()

static void Logger::setLevel ( LogLevel  ll)
inlinestatic

Definition at line 70 of file logging.hh.

References enabled, FATAL, getFatal(), getHack(), getInfo(), getPanic(), getWarn(), HACK, INFO, PANIC, and WARN.

Referenced by pybind_init_core().

Member Data Documentation

◆ enabled

bool Logger::enabled
protected

Definition at line 127 of file logging.hh.

Referenced by print(), and setLevel().

◆ prefix

const char* Logger::prefix
protected

Definition at line 132 of file logging.hh.

Referenced by Logger(), and print().


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

Generated on Wed Sep 30 2020 14:02:26 for gem5 by doxygen 1.8.17