Cantera
2.0
|
Class to carry out messages. More...
#include <application.h>
Public Member Functions | |
Messages () | |
Constructor for the Messages class. | |
Messages (const Messages &r) | |
Copy Constructor for the Messages class. | |
Messages & | operator= (const Messages &r) |
Assignment operator. | |
~Messages () | |
Destructor for the Messages class. | |
void | addError (std::string r, std::string msg) |
Set an error condition in the application class without throwing an exception. | |
int | getErrorCount () |
Return the number of errors that have been encountered so far. | |
void | popError () |
Discard the last error message. | |
std::string | lastErrorMessage () |
Retrieve the last error message in a string. | |
void | getErrors (std::ostream &f) |
Prints all of the error messages to an ostream. | |
void | logErrors () |
Prints all of the error messages using writelog. | |
void | writelog (const std::string &msg) |
Write a message to the screen. | |
void | writelogendl () |
Write an end of line and flush output. | |
void | writelog (const char *pszmsg) |
Write a message to the screen. | |
void | logerror (const std::string &msg) |
Write an error message and quit. | |
int | getUserEnv () |
Returns an integer specifying the application environment. | |
void | setLogger (Logger *logwriter) |
Install a logger. | |
void | beginLogGroup (std::string title, int loglevel) |
Create a new group for log messages. | |
void | addLogEntry (std::string tag, std::string value) |
Add an entry to an HTML log file. | |
void | addLogEntry (std::string tag, doublereal value) |
Add an entry to an HTML log file. | |
void | addLogEntry (std::string tag, int value) |
Add an entry to an HTML log file. | |
void | addLogEntry (std::string msg) |
Add an entry to an HTML log file. | |
void | endLogGroup (std::string title) |
Close the current group of log messages. | |
void | write_logfile (std::string file) |
Write the HTML log file. | |
Protected Attributes | |
std::vector< std::string > | errorMessage |
Current list of error messages. | |
std::vector< std::string > | errorRoutine |
Current error Routine. | |
Logger * | logwriter |
Current pointer to the logwriter. | |
XML_Node * | xmllog |
Current pointer to the top of the XML_Node tree for the current HTML log. | |
XML_Node * | current |
Pointer to the last current position in the XML_Node tree for the current HTML log. | |
int | loglevel |
Current value of the loglevel. | |
std::vector< int > | loglevels |
Vector of loglevels for loggroups that are open. | |
std::vector< std::string > | loggroups |
Current vector of loggroups that are open. | |
Class to carry out messages.
Definition at line 48 of file application.h.
Messages | ( | ) |
Constructor for the Messages class.
Constructor for the Messages class which is a subclass of the Application class.
Definition at line 51 of file application.cpp.
References Application::Messages::logwriter.
Copy Constructor for the Messages class.
Constructor for the Messages class which is a subclass of the Application class.
r | Message to be copied |
Definition at line 68 of file application.cpp.
References Application::Messages::logwriter.
~Messages | ( | ) |
Destructor for the Messages class.
Definition at line 102 of file application.cpp.
References Application::write_logfile().
Application::Messages & operator= | ( | const Messages & | r | ) |
Assignment operator.
r | Message to be copied |
Definition at line 85 of file application.cpp.
References Application::Messages::current, Application::Messages::errorMessage, Application::Messages::errorRoutine, Application::Messages::loggroups, Application::Messages::loglevel, Application::Messages::loglevels, Application::Messages::logwriter, and Application::Messages::xmllog.
void writelogendl | ( | ) |
Write an end of line and flush output.
Definition at line 161 of file application.cpp.
Referenced by Application::writelogendl().
void logerror | ( | const std::string & | msg | ) |
Write an error message and quit.
The default behavior is to write to the standard error stream, and then call exit(). Note that no end-of-line character is appended to the message, and so if one is desired it must be included in the string. Note that this default behavior will terminate the application Cantera is invoked from (MATLAB, Excel, etc.) If this is not desired, then derive a class and reimplement this method.
msg | Error message to be written to cerr. |
Definition at line 143 of file application.cpp.
Referenced by Application::logerror().
int getUserEnv | ( | ) |
Returns an integer specifying the application environment.
Definition at line 137 of file application.cpp.
Referenced by Application::getUserEnv().
void endLogGroup | ( | std::string | title | ) |
Close the current group of log messages.
This is typically called just before leaving a function or method, to close the group of messages that were output from this function. Subsequent messages written with addLogEntry() will appear at the next-higher level in the outline, unless beginLogGroup() is called first to create a new group.
title | Name of the log group. It defaults to the most recent log group created. |
Definition at line 222 of file application.cpp.
References AssertThrowMsg, Application::write_logfile(), and Application::writelog().
Referenced by Application::endLogGroup().
void write_logfile | ( | std::string | file | ) |
Write the HTML log file.
Log entries are stored in memory in an XML tree until this function is called, which writes the tree to a file and clears the entries stored in memory. The output file will have the name specified in the 'file' argument. If this argument has no extension, the extension '.html' will be appended. Also, if the file already exists, an integer will be appended to the name so that no existing log file will be overwritten. WITH_HTML_LOGS must be defined.
file | Name of the file to be written |
Definition at line 253 of file application.cpp.
References Cantera::int2str(), Cantera::npos, and Application::writelog().
Referenced by Application::write_logfile().
|
protected |
Current list of error messages.
Definition at line 284 of file application.h.
Referenced by Application::Messages::operator=(), and Application::Messages::popError().
|
protected |
Current error Routine.
Definition at line 287 of file application.h.
Referenced by Application::Messages::operator=(), and Application::Messages::popError().
|
protected |
Current pointer to the logwriter.
Definition at line 290 of file application.h.
Referenced by Application::Messages::Messages(), and Application::Messages::operator=().
|
protected |
Current pointer to the top of the XML_Node tree for the current HTML log.
Definition at line 293 of file application.h.
Referenced by Application::Messages::operator=().
|
protected |
Pointer to the last current position in the XML_Node tree for the current HTML log.
Definition at line 296 of file application.h.
Referenced by Application::Messages::operator=().
|
protected |
Current value of the loglevel.
Definition at line 299 of file application.h.
Referenced by Application::Messages::operator=().
|
protected |
Vector of loglevels for loggroups that are open.
Definition at line 302 of file application.h.
Referenced by Application::Messages::operator=().
|
protected |
Current vector of loggroups that are open.
Definition at line 305 of file application.h.
Referenced by Application::Messages::operator=().