ECF 1.7

Logging class - handles screen output and file logging. More...

#include <Logger.h>

Classes

struct  Log

Public Member Functions

void log (int logLevel, std::string message)
void saveTo (std::string fileName)
void saveTo (bool check=false)
void saveToX (std::string fileName)
void saveToX ()
void flushLog ()
 deletes current logs
void setLogFrequency (uint freq)
void registerParameters (StateP state)
bool initialize (StateP state)
bool operate (StateP)
void closeLog ()
uint getLogLevel ()

Protected Attributes

std::vector< Loglogs_
uint currentLevel_
uint logFrequency_
std::string logFileName_
bool bFileDefined_
std::ofstream logFile_
StateP state_

Detailed Description

Logging class - handles screen output and file logging.

Current log levels (1-5): 1=only basic, essential information, 3=medium logging level (default), 5=logs everything

Definition at line 32 of file Logger.h.

Constructor & Destructor Documentation

◆ Logger()

Logger::Logger ( )

Definition at line 5 of file Logger.cpp.

◆ ~Logger()

Logger::~Logger ( )

Definition at line 13 of file Logger.cpp.

Member Function Documentation

◆ closeLog()

void Logger::closeLog ( )
inline

Definition at line 81 of file Logger.h.

◆ flushLog()

void Logger::flushLog ( )

deletes current logs

Definition at line 165 of file Logger.cpp.

◆ getLogLevel()

uint Logger::getLogLevel ( )
inline

Definition at line 84 of file Logger.h.

◆ initialize()

bool Logger::initialize ( StateP state)

Initialize Logger, read current logLevel from the Registry (configuration file)

Definition at line 33 of file Logger.cpp.

◆ log()

void Logger::log ( int logLevel,
std::string message )

Puts a string message into existing log and marks it with appropriate logLevel.

Definition at line 63 of file Logger.cpp.

◆ operate()

bool Logger::operate ( StateP state)

Definition at line 171 of file Logger.cpp.

◆ registerParameters()

void Logger::registerParameters ( StateP state)

Definition at line 19 of file Logger.cpp.

◆ saveTo() [1/2]

void Logger::saveTo ( bool check = false)

Saves current session log into a configured logfile. New log is appended to the end of the file.

Definition at line 96 of file Logger.cpp.

◆ saveTo() [2/2]

void Logger::saveTo ( std::string fileName)

Saves current session log into a file named fileName. If file with the same name already exists, log is appended to the end of the file.

Definition at line 84 of file Logger.cpp.

◆ saveToX() [1/2]

void Logger::saveToX ( )

Definition at line 151 of file Logger.cpp.

◆ saveToX() [2/2]

void Logger::saveToX ( std::string fileName)

Definition at line 136 of file Logger.cpp.

◆ setLogFrequency()

void Logger::setLogFrequency ( uint freq)

Sets the log output frequency (in generations). If not set, the default is 1 (output each generation).

Definition at line 178 of file Logger.cpp.

Member Data Documentation

◆ bFileDefined_

bool Logger::bFileDefined_
protected

Definition at line 92 of file Logger.h.

◆ currentLevel_

uint Logger::currentLevel_
protected

Definition at line 89 of file Logger.h.

◆ logFile_

std::ofstream Logger::logFile_
protected

Definition at line 93 of file Logger.h.

◆ logFileName_

std::string Logger::logFileName_
protected

Definition at line 91 of file Logger.h.

◆ logFrequency_

uint Logger::logFrequency_
protected

Definition at line 90 of file Logger.h.

◆ logs_

std::vector<Log> Logger::logs_
protected

Definition at line 88 of file Logger.h.

◆ state_

StateP Logger::state_
protected

Definition at line 94 of file Logger.h.


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