Version: 8.3.0
YACS::ENGINE::LogRecord Class Reference

Class for logging record. More...

#include <LogRecord.hxx>

Collaboration diagram for YACS::ENGINE::LogRecord:

Public Types

typedef int LogLevel
 

Public Member Functions

 LogRecord (const std::string &name, int level, const std::string &message, const std::string &file, int line)
 
virtual ~LogRecord ()
 
virtual std::string getLevelName (int level)
 
virtual std::string getStr ()
 

Public Attributes

const std::string _loggerName
 
const std::string _message
 
int _level
 
std::string _fileName
 
int _line
 

Static Public Attributes

static const LogLevel FATAL = 50
 
static const LogLevel ERROR = 40
 
static const LogLevel WARNING = 30
 
static const LogLevel INFO = 20
 
static const LogLevel DEBUG = 10
 
static const LogLevel NOTSET = 0
 

Detailed Description

Class for logging record.

Definition at line 32 of file LogRecord.hxx.

Member Typedef Documentation

Definition at line 35 of file LogRecord.hxx.

Constructor & Destructor Documentation

LogRecord::LogRecord ( const std::string &  name,
int  level,
const std::string &  message,
const std::string &  file,
int  line 
)

Definition at line 30 of file LogRecord.cxx.

31  :_loggerName(name),_level(level),_message(message),_fileName(file),_line(line)
32 {
33 }
LogRecord::~LogRecord ( )
virtual

Definition at line 35 of file LogRecord.cxx.

36 {
37 }

Member Function Documentation

std::string LogRecord::getLevelName ( int  level)
virtual

Definition at line 39 of file LogRecord.cxx.

References DEBUG, ERROR, FATAL, INFO, and WARNING.

Referenced by getStr().

40 {
41  switch(level)
42  {
43  case FATAL:
44  return "FATAL";
45  case ERROR:
46  return "ERROR";
47  case WARNING:
48  return "WARNING";
49  case INFO:
50  return "INFO";
51  case DEBUG:
52  return "DEBUG";
53  default:
54  return "NOTSET";
55  }
56 }
std::string LogRecord::getStr ( )
virtual

Definition at line 58 of file LogRecord.cxx.

References _fileName, _level, _line, _loggerName, _message, and getLevelName().

59 {
60  std::stringstream msg;
61  msg << "LogRecord: " << _loggerName << ":" << getLevelName(_level) << ":" << _message;
62  if(_fileName != "")
63  msg << " (" << _fileName << ":" << _line << ")";
64  return msg.str();
65 }

Member Data Documentation

std::string YACS::ENGINE::LogRecord::_fileName

filename of logging record

Definition at line 52 of file LogRecord.hxx.

Referenced by getStr().

int YACS::ENGINE::LogRecord::_level

Level of logging record

Definition at line 50 of file LogRecord.hxx.

Referenced by getStr().

int YACS::ENGINE::LogRecord::_line

line number of logging record

Definition at line 54 of file LogRecord.hxx.

Referenced by getStr().

const std::string YACS::ENGINE::LogRecord::_loggerName

The logger name.

Definition at line 46 of file LogRecord.hxx.

Referenced by getStr().

const std::string YACS::ENGINE::LogRecord::_message

The message of logging record

Definition at line 48 of file LogRecord.hxx.

Referenced by getStr().

const LogLevel YACS::ENGINE::LogRecord::DEBUG = 10
static

Definition at line 40 of file LogRecord.hxx.

Referenced by getLevelName().

const LogLevel YACS::ENGINE::LogRecord::ERROR = 40
static

Definition at line 37 of file LogRecord.hxx.

Referenced by YACS::ENGINE::Logger::error(), and getLevelName().

const LogLevel YACS::ENGINE::LogRecord::FATAL = 50
static

Definition at line 36 of file LogRecord.hxx.

Referenced by YACS::ENGINE::Logger::fatal(), and getLevelName().

const LogLevel YACS::ENGINE::LogRecord::INFO = 20
static

Definition at line 39 of file LogRecord.hxx.

Referenced by getLevelName().

const LogLevel YACS::ENGINE::LogRecord::NOTSET = 0
static

Definition at line 41 of file LogRecord.hxx.

const LogLevel YACS::ENGINE::LogRecord::WARNING = 30
static

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