Cantera  2.0
Classes | Functions
Writing HTML Logfiles
Diagnostic Output
Collaboration diagram for Writing HTML Logfiles:

Classes

class  Application
 Class to hold global data. More...
 
class  Application::Messages
 Class to carry out messages. More...
 
class  Application::ThreadMessages
 Class that stores thread messages for each thread, and retrieves them based on the thread id. More...
 

Functions

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 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 beginLogGroup (std::string title, int loglevel=-99)
 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 msg string to an HTML log file.
 
void endLogGroup (std::string title="")
 Close the current group of log messages.
 
void write_logfile (std::string file="log.html")
 Write the HTML log file.
 

Detailed Description

These functions are designed to allow writing HTML diagnostic messages in a manner that allows users to control how much diagnostic output to print. It works like this: Suppose you have function A that invokes function B that invokes function C. You want to be able to print diagnostic messages just from function A, or from A and B, or from A, B, and C, or to turn off printing diagnostic messages altogether. All you need to do is call 'beginLogGroup' within function A, and specify a loglevel value. Then in B, call beginLogGroup again, but without an explicit value for loglevel. By default, the current level is decremented by one in beginLogGroup. If it is <= 0, no log messages are written. Thus, if each function begins with beginLogGroup and calls endLogGroup before returning, then setting loglevel = 3 will cause messages from A, B, and C to be written (in nested HTML lists), loglevel = 2 results in messages only being written from A and B, etc.

Function Documentation

void beginLogGroup ( std::string  title,
int  loglevel 
)

Create a new group for log messages.

Usually this is called upon entering the function, with the title parameter equal to the name of the function or method. Subsequent messages written with addLogEntry will appear grouped under this heading, until endLogGroup() is called.

Parameters
titleString name of the LogGroup
loglevelloglevel of the group.

Definition at line 168 of file application.cpp.

Referenced by Application::beginLogGroup().

void addLogEntry ( std::string  tag,
std::string  value 
)

Add an entry to an HTML log file.

Entries appear in the form "tag:value".

Parameters
tagtag
valuedouble value

Definition at line 194 of file application.cpp.

Referenced by Application::addLogEntry().

void addLogEntry ( std::string  tag,
doublereal  value 
)

Add an entry to an HTML log file.

Entries appear in the form "tag:value".

Parameters
tagtag
valuedouble value

Definition at line 201 of file application.cpp.

References Cantera::fp2str().

void addLogEntry ( std::string  tag,
int  value 
)

Add an entry to an HTML log file.

Entries appear in the form "tag:value".

Parameters
tagtag
valuedouble value

Definition at line 208 of file application.cpp.

References Cantera::int2str().

void addLogEntry ( std::string  msg)

Add an entry to an HTML log file.

Entries appear in the form "msg".

Parameters
msgMessage to be added

Definition at line 215 of file application.cpp.

void beginLogGroup ( std::string  title,
int  loglevel 
)
inline

Create a new group for log messages.

Usually this is called upon entering the function, with the title parameter equal to the name of the function or method. Subsequent messages written with addLogEntry will appear grouped under this heading, until endLogGroup() is called.

Parameters
titleString name of the LogGroup
loglevelloglevel of the group.

Definition at line 585 of file application.h.

References Application::Messages::beginLogGroup(), and Application::pMessenger.

Referenced by Cantera::beginLogGroup().

void addLogEntry ( std::string  tag,
std::string  value 
)
inline

Add an entry to an HTML log file.

Entries appear in the form "tag:value".

Parameters
tagtag
valuedouble value

Definition at line 598 of file application.h.

References Application::Messages::addLogEntry(), and Application::pMessenger.

Referenced by Cantera::addLogEntry().

void addLogEntry ( std::string  tag,
doublereal  value 
)
inline

Add an entry to an HTML log file.

Entries appear in the form "tag:value".

Parameters
tagtag
valuedouble value

Definition at line 611 of file application.h.

References Application::Messages::addLogEntry(), and Application::pMessenger.

void addLogEntry ( std::string  tag,
int  value 
)
inline

Add an entry to an HTML log file.

Entries appear in the form "tag:value".

Parameters
tagtag
valuedouble value

Definition at line 624 of file application.h.

References Application::Messages::addLogEntry(), and Application::pMessenger.

void addLogEntry ( std::string  msg)
inline

Add an entry to an HTML log file.

Entries appear in the form "msg".

Parameters
msgMessage to be added to file

Definition at line 636 of file application.h.

References Application::Messages::addLogEntry(), and Application::pMessenger.

void endLogGroup ( std::string  title)
inline

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.

Parameters
titleName of the log group. It defaults to the most recent log group created.

Definition at line 653 of file application.h.

References Application::Messages::endLogGroup(), and Application::pMessenger.

Referenced by Cantera::endLogGroup().

void beginLogGroup ( std::string  title,
int  loglevel = -99 
)

Create a new group for log messages.

Usually this is called upon entering the function, with the title parameter equal to the name of the function or method. Subsequent messages written with addLogEntry will appear grouped under this heading, until endLogGroup() is called.

Parameters
titleString name of the LogGroup
loglevelloglevel of the group.

Definition at line 80 of file global.cpp.

References Cantera::app(), and Application::beginLogGroup().

Referenced by vcs_MultiPhaseEquil::determine_PhaseStability(), Cantera::equilibrate(), ChemEquil::equilibrate(), MultiPhase::equilibrate(), vcs_MultiPhaseEquil::equilibrate_HP(), vcs_MultiPhaseEquil::equilibrate_SP(), vcs_MultiPhaseEquil::equilibrate_TP(), vcs_MultiPhaseEquil::equilibrate_TV(), ChemEquil::equilResidual(), ChemEquil::estimateElementPotentials(), MultiPhaseEquil::setInitialMoles(), ChemEquil::setInitialMoles(), MultiPhaseEquil::stepComposition(), Cantera::vcs_determine_PhaseStability(), Cantera::vcs_equilibrate(), and Cantera::vcs_equilibrate_1().

void addLogEntry ( std::string  tag,
std::string  value 
)
void addLogEntry ( std::string  tag,
doublereal  value 
)

Add an entry to an HTML log file.

Entries appear in the form "tag:value".

Parameters
tagtag
valuedouble value

Definition at line 90 of file global.cpp.

References Application::addLogEntry(), and Cantera::app().

void addLogEntry ( std::string  tag,
int  value 
)

Add an entry to an HTML log file.

Entries appear in the form "tag:value".

Parameters
tagtag
valueint value

Definition at line 95 of file global.cpp.

References Application::addLogEntry(), and Cantera::app().

void addLogEntry ( std::string  msg)

Add an entry msg string to an HTML log file.

Add a message string to the HTML log file

Parameters
msgstring mesg

Definition at line 100 of file global.cpp.

References Application::addLogEntry(), and Cantera::app().

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.

Parameters
titleName of the log group. It defaults to the most recent log group created.

Definition at line 105 of file global.cpp.

References Cantera::app(), and Application::endLogGroup().

Referenced by vcs_MultiPhaseEquil::determine_PhaseStability(), Cantera::equilibrate(), ChemEquil::equilibrate(), MultiPhase::equilibrate(), vcs_MultiPhaseEquil::equilibrate_HP(), vcs_MultiPhaseEquil::equilibrate_SP(), vcs_MultiPhaseEquil::equilibrate_TP(), vcs_MultiPhaseEquil::equilibrate_TV(), ChemEquil::equilResidual(), ChemEquil::estimateElementPotentials(), MultiPhaseEquil::setInitialMoles(), ChemEquil::setInitialMoles(), MultiPhaseEquil::stepComposition(), Cantera::vcs_determine_PhaseStability(), Cantera::vcs_equilibrate(), and Cantera::vcs_equilibrate_1().

void write_logfile ( std::string  file = "log.html")

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.

Parameters
fileName of the file to be written

Definition at line 110 of file global.cpp.

References Cantera::app(), and Application::write_logfile().