gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Logger Class Reference

#include <misc.hh>

Inheritance diagram for Logger:
ExitLogger

Public Types

enum  LogLevel {
  PANIC = 0, FATAL, WARN, INFO,
  HACK, NUM_LOG_LEVELS
}
 

Public Member Functions

 Logger (std::ostream &stream, const char *prefix)
 
virtual ~Logger ()
 
template<typename... Args>
void print (const char *func, const char *file, int line, const char *format, const Args &...args)
 
template<typename... Args>
void print (const char *func, const char *file, int line, const std::string &format, const Args &...args)
 

Static Public Member Functions

static void setLevel (LogLevel ll)
 Set the active log level. More...
 
static Loggerget (LogLevel ll)
 Get a Logger corresponding to a specific log level. More...
 

Public Attributes

bool enabled
 
bool verbose
 

Protected Member Functions

virtual void printEpilogue (const char *func, const char *file, int line, const char *format)
 

Protected Attributes

std::ostream & stream
 
const char * prefix
 

Detailed Description

Definition at line 60 of file misc.hh.

Member Enumeration Documentation

Enumerator
PANIC 
FATAL 
WARN 
INFO 
HACK 
NUM_LOG_LEVELS 

Definition at line 63 of file misc.hh.

Constructor & Destructor Documentation

Logger::Logger ( std::ostream &  stream,
const char *  prefix 
)

Definition at line 90 of file misc.cc.

Referenced by get().

virtual Logger::~Logger ( )
inlinevirtual

Definition at line 92 of file misc.hh.

Member Function Documentation

Logger & Logger::get ( LogLevel  ll)
static

Get a Logger corresponding to a specific log level.

Parameters
llLog level to access
Returns
Reference to the requested logger

Definition at line 56 of file misc.cc.

References Logger().

template<typename... Args>
void Logger::print ( const char *  func,
const char *  file,
int  line,
const char *  format,
const Args &...  args 
)
inline

Definition at line 95 of file misc.hh.

References ccprintf(), enabled, prefix, printEpilogue(), and stream.

Referenced by print().

template<typename... Args>
void Logger::print ( const char *  func,
const char *  file,
int  line,
const std::string &  format,
const Args &...  args 
)
inline

Definition at line 109 of file misc.hh.

References print().

void Logger::printEpilogue ( const char *  func,
const char *  file,
int  line,
const char *  format 
)
protectedvirtual

Reimplemented in ExitLogger.

Definition at line 96 of file misc.cc.

References ccprintf(), curTick(), newline_if_needed(), stream, and verbose.

Referenced by print(), and ExitLogger::printEpilogue().

void Logger::setLevel ( LogLevel  ll)
static

Set the active log level.

All levels that are lower or equal to the selected log level will be activated.

Parameters
llMaximum log level to print

Definition at line 70 of file misc.cc.

References ArmISA::i, and NUM_LOG_LEVELS.

Referenced by pybind_init_core().

Member Data Documentation

bool Logger::enabled

Definition at line 120 of file misc.hh.

Referenced by print().

const char* Logger::prefix
protected

Definition at line 125 of file misc.hh.

Referenced by print().

std::ostream& Logger::stream
protected

Definition at line 124 of file misc.hh.

Referenced by print(), printEpilogue(), and ExitLogger::printEpilogue().

bool Logger::verbose

Definition at line 121 of file misc.hh.

Referenced by printEpilogue().


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

Generated on Fri Jun 9 2017 13:04:14 for gem5 by doxygen 1.8.6