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 logger. | |
void | warnlog (const string &warning, const string &msg) |
Write a warning message to the logger. | |
void | setLogger (Logger *logwriter) |
Install a logger. | |
void | setLogger (unique_ptr< Logger > logwriter) |
Install a Logger. | |
void | writelog_direct (const string &msg) |
Write a message to the logger. | |
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 | setLogger (unique_ptr< Logger > logwriter) |
Install a Logger. | |
void writelog | ( | const string & | msg | ) |
Write a message to the logger.
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 logger |
Definition at line 201 of file application.cpp.
void warnlog | ( | const string & | warning, |
const string & | msg | ||
) |
Write a warning message to the logger.
warning | Type of warning; see Logger::warn() |
msg | Message to be written to the logger |
Definition at line 211 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 |
unique_ptr
. Definition at line 191 of file application.cpp.
void setLogger | ( | unique_ptr< Logger > | logwriter | ) |
Install a Logger.
Called by the language interfaces to install an appropriate logger. The logger is used for the writelog() function
unique_ptr
instead of bare pointer. Definition at line 196 of file application.cpp.
void writelog_direct | ( | const string & | msg | ) |
Write a message to the logger.
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 logger |
Definition at line 45 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 50 of file global.cpp.
void writeline | ( | char | repeat, |
size_t | count, | ||
bool | endl_after, | ||
bool | endl_before | ||
) |
Definition at line 55 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 |
unique_ptr
. unique_ptr
.Definition at line 27 of file global.cpp.
void setLogger | ( | unique_ptr< Logger > | logwriter | ) |
Install a Logger.
Called by the language interfaces to install an appropriate logger. The logger is used for the writelog() function
unique_ptr
instead of bare pointer. unique_ptr
instead of bare pointer. Definition at line 36 of file global.cpp.