Cantera
3.0.0
|
Logging and generation of diagnostic output. More...
Logging and generation of diagnostic output.
Writing diagnostic information to the screen or to a file. It is often useful to be able to write diagnostic messages to the screen or to a file. Cantera defines a set of procedures for this purpose designed to write text messages to the screen to document the progress of a complex calculation, such as a flame simulation.
Classes | |
class | ExternalLogger |
Logger that delegates to an external source via a callback to produce log output. More... | |
class | Logger |
Base class for 'loggers' that write text messages to log files. More... | |
class | NoExitLogger |
Logger that doesn't exit when an error is thrown. More... | |
Functions | |
void | writelog (const string &msg) |
Write a message to the screen. | |
void | warnlog (const string &warning, const string &msg) |
Write a warning message to the screen. | |
void | setLogger (Logger *logwriter) |
Install a logger. | |
void | writelog_direct (const string &msg) |
Write a message to the screen. | |
void | debuglog (const string &msg, int loglevel) |
Write a message to the log only if loglevel > 0. | |
template<typename... Args> | |
void | writelog (const string &fmt, const Args &... args) |
Write a formatted message to the screen. | |
template<typename... Args> | |
void | writelogf (const char *fmt, const Args &... args) |
Write a formatted message to the screen. | |
void | writelogendl () |
Write an end of line character to the screen and flush output. | |
void | writeline (char repeat, size_t count, bool endl_after, bool endl_before) |
void | setLogger (Logger *logwriter) |
Install a logger. | |
void writelog | ( | const string & | msg | ) |
Write a message to the screen.
The string may be of any length, and may contain end-of-line characters. This method is used throughout Cantera to write log messages. It can also be called by user programs. The advantage of using writelog over writing directly to the standard output is that messages written with writelog will display correctly even when Cantera is used from MATLAB or other application that do not have a standard output stream.
msg | c++ string to be written to the screen |
Definition at line 69 of file application.cpp.
void warnlog | ( | const string & | warning, |
const string & | msg | ||
) |
Write a warning message to the screen.
warning | String specifying type of warning; see Logger::warn() |
msg | String to be written to the screen |
Definition at line 79 of file application.cpp.
void setLogger | ( | Logger * | logwriter | ) |
Install a logger.
Called by the language interfaces to install an appropriate logger. The logger is used for the writelog() function
logwriter | Pointer to a logger object |
Definition at line 64 of file application.cpp.
void writelog_direct | ( | const string & | msg | ) |
Write a message to the screen.
The string may be of any length, and may contain end-of-line characters. This method is used throughout Cantera to write log messages. It can also be called by user programs. The advantage of using writelog over writing directly to the standard output is that messages written with writelog will display correctly even when Cantera is used from MATLAB or other application that do not have a standard output stream.
msg | c++ string to be written to the screen |
Definition at line 36 of file global.cpp.
|
inline |
void writelog | ( | const string & | fmt, |
const Args &... | args | ||
) |
Write a formatted message to the screen.
This function passes its arguments to the fmt library 'format' function to generate a formatted string from a Python-style (curly braces) format string. This method is used throughout Cantera to write log messages. It can also be called by user programs. The advantage of using writelog over writing directly to the standard output is that messages written with writelog will display correctly even when Cantera is used from MATLAB or other application that do not have a standard output stream.
void writelogf | ( | const char * | fmt, |
const Args &... | args | ||
) |
Write a formatted message to the screen.
Using the printf formatting of C, write a message to the screen with variable values.
Here, we format an internal string with the correct values and then feed it into writelog().
fmt | c format string for the following arguments |
args | arguments used to interpolate the format string |
void writelogendl | ( | ) |
Write an end of line character to the screen and flush output.
Definition at line 41 of file global.cpp.
void writeline | ( | char | repeat, |
size_t | count, | ||
bool | endl_after, | ||
bool | endl_before | ||
) |
Definition at line 46 of file global.cpp.
void setLogger | ( | Logger * | logwriter | ) |
Install a logger.
Called by the language interfaces to install an appropriate logger. The logger is used for the writelog() function
logwriter | Pointer to a logger object |
Definition at line 27 of file global.cpp.