AQUAgpusph 4.1.2
|
On screen and log file output manager. More...
#include <Logger.h>
Public Member Functions | |
Logger () | |
Constructor. | |
~Logger () | |
Destructor. | |
void | initNCurses () |
Transform the terminal into an ncurses one. | |
void | endNCurses () |
Transform the terminal into an ncurses one. | |
void | initFrame () |
Call to setup a new terminal frame. | |
void | endFrame () |
Call to refresh the terminal frame. | |
void | writeReport (std::string msg, std::string color="white", bool bold=false) |
Write a new message in the terminal output. | |
void | addMessage (TLogLevel level, std::string log, std::string func="") |
Add a new log record message. | |
void | printDate (TLogLevel level=L_DEBUG) |
Print a time stamp in the screen and the log file. | |
void | printOpenCLError (cl_int error, TLogLevel level=L_DEBUG) |
Print an OpenCL error. | |
void | save (float t) |
Do nothing. | |
Public Member Functions inherited from Aqua::InputOutput::Report | |
virtual void | save (float t)=0 |
Save the data. | |
virtual void | load () |
Load the data. | |
std::string | file () |
Get the used output file path. | |
virtual void | save (float t)=0 |
Save the data. | |
virtual void | load ()=0 |
Load the data. | |
Protected Member Functions | |
void | printLog () |
Print the log record. | |
void | refreshAll () |
void | open () |
Create the log file. | |
void | close () |
Close the log file. | |
Protected Member Functions inherited from Aqua::Singleton< Aqua::InputOutput::Logger > | |
Singleton () | |
Constructor. | |
virtual | ~Singleton () |
Destructor. | |
Protected Member Functions inherited from Aqua::InputOutput::Report | |
Report () | |
Constructor. | |
virtual | ~Report () |
Destructor. | |
void | file (std::string filename) |
Set the report file name. | |
void | file (std::string basename, unsigned int start_index) |
Look for the first non-existing file name. | |
Protected Member Functions inherited from Aqua::InputOutput::InputOutput | |
InputOutput () | |
Constructor. | |
virtual | ~InputOutput () |
Destructor. | |
Additional Inherited Members | |
Static Public Member Functions inherited from Aqua::Singleton< Aqua::InputOutput::Logger > | |
static Aqua::InputOutput::Logger * | singleton () |
Returns the instance of the class. | |
On screen and log file output manager.
AQUAgpusph is generating, during runtime, an HTML log file, placed in the execution folder, and named log.X.html, where X is replaced by the first unsigned integer which generates a non-existing file.
Aqua::InputOutput::Logger::Logger | ( | ) |
Constructor.
Aqua::InputOutput::Logger::~Logger | ( | ) |
Destructor.
void Aqua::InputOutput::Logger::addMessage | ( | TLogLevel | level, |
std::string | log, | ||
std::string | func = "" |
||
) |
Add a new log record message.
The old messages may be removed from the terminal if no more space left.
level | Message classification (L_DEBUG, L_INFO, L_WARNING, L_ERROR) |
log | Log message. |
func | Function name to print, NULL if it should not be printed. |
|
protected |
Close the log file.
void Aqua::InputOutput::Logger::endFrame | ( | ) |
Call to refresh the terminal frame.
This method should be called at the end of every time step.
void Aqua::InputOutput::Logger::endNCurses | ( | ) |
Transform the terminal into an ncurses one.
This method should be called after finishing the simulation main loop
void Aqua::InputOutput::Logger::initFrame | ( | ) |
Call to setup a new terminal frame.
This method should be called at the start of every time step.
void Aqua::InputOutput::Logger::initNCurses | ( | ) |
Transform the terminal into an ncurses one.
This method should be called ONCE before starting the simulation main loop
|
protected |
Create the log file.
Print a time stamp in the screen and the log file.
level | Message classification (L_DEBUG, L_INFO, L_WARNING, L_ERROR) |
|
protected |
Print the log record.
This function will compute automatically where the log record should be placed
Print an OpenCL error.
error | Error code returned by OpenCL. |
level | Message classification (L_DEBUG, L_INFO, L_WARNING, L_ERROR) |
|
protected |
Call to refresh the output screen, useless if ncurses is not active.
|
inlinevirtual |
void Aqua::InputOutput::Logger::writeReport | ( | std::string | msg, |
std::string | color = "white" , |
||
bool | bold = false |
||
) |
Write a new message in the terminal output.
This method is not redirecting the data to the log file. In case that ncurses is active:
msg | Message to print in the screen. |
color | Color name. Valid colors are:
|
bold | true if bold font should be used, false otherwise |