Cantera
2.1.2
|
Class to carry out messages. More...
#include <application.h>
Public Member Functions | |
Messages () | |
Constructor for the Messages class. More... | |
Messages (const Messages &r) | |
Messages & | operator= (const Messages &r) |
void | addError (const std::string &r, const std::string &msg) |
Set an error condition in the application class without throwing an exception. More... | |
int | getErrorCount () |
Return the number of errors that have been encountered so far. More... | |
void | popError () |
Discard the last error message. More... | |
std::string | lastErrorMessage () |
Retrieve the last error message in a string. More... | |
void | getErrors (std::ostream &f) |
Prints all of the error messages to an ostream. More... | |
void | logErrors () |
Prints all of the error messages using writelog. More... | |
void | writelog (const std::string &msg) |
Write a message to the screen. More... | |
void | writelogendl () |
Write an end of line character to the screen and flush output. More... | |
void | logerror (const std::string &msg) |
Write an error message and quit. More... | |
void | setLogger (Logger *logwriter) |
Install a logger. More... | |
void | beginLogGroup (const std::string &title, int loglevel) |
Create a new group for log messages. More... | |
void | addLogEntry (const std::string &tag, const std::string &value) |
Add an entry to an HTML log file. More... | |
void | addLogEntry (const std::string &tag, doublereal value) |
Add an entry to an HTML log file. More... | |
void | addLogEntry (const std::string &tag, int value) |
Add an entry to an HTML log file. More... | |
void | addLogEntry (const std::string &msg) |
Add an entry to an HTML log file. More... | |
void | endLogGroup (const std::string &title) |
Close the current group of log messages. More... | |
void | write_logfile (const std::string &file) |
Write the HTML log file. More... | |
Protected Attributes | |
std::vector< std::string > | errorMessage |
Current list of error messages. More... | |
std::vector< std::string > | errorRoutine |
Current error Routine. More... | |
Logger * | logwriter |
Current pointer to the logwriter. More... | |
XML_Node * | xmllog |
Current pointer to the top of the XML_Node tree for the current HTML log. More... | |
XML_Node * | current |
Pointer to the last current position in the XML_Node tree for the current HTML log. More... | |
int | loglevel |
Current value of the loglevel. More... | |
std::vector< int > | loglevels |
Vector of loglevels for loggroups that are open. More... | |
std::vector< std::string > | loggroups |
Current vector of loggroups that are open. More... | |
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 53 of file application.cpp.
References Application::Messages::logwriter.
void writelogendl | ( | ) |
Write an end of line character to the screen and flush output.
Definition at line 148 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 138 of file application.cpp.
Referenced by Application::logerror().
void endLogGroup | ( | const 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 215 of file application.cpp.
References AssertThrowMsg, Application::write_logfile(), and Application::writelog().
Referenced by Application::endLogGroup().
void write_logfile | ( | const 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 244 of file application.cpp.
References Cantera::int2str(), Cantera::npos, Cantera::warn_deprecated(), and Application::writelog().
Referenced by Application::write_logfile().
|
protected |
Current list of error messages.
Definition at line 261 of file application.h.
Referenced by Application::Messages::popError().
|
protected |
Current error Routine.
Definition at line 264 of file application.h.
Referenced by Application::Messages::popError().
|
protected |
Current pointer to the logwriter.
Definition at line 267 of file application.h.
Referenced by Application::Messages::Messages().
|
protected |
Current pointer to the top of the XML_Node tree for the current HTML log.
Definition at line 270 of file application.h.
|
protected |
Pointer to the last current position in the XML_Node tree for the current HTML log.
Definition at line 273 of file application.h.
|
protected |
Current value of the loglevel.
Definition at line 276 of file application.h.
|
protected |
Vector of loglevels for loggroups that are open.
Definition at line 279 of file application.h.
|
protected |
Current vector of loggroups that are open.
Definition at line 282 of file application.h.