Cantera  3.1.0a1

Logging and generation of diagnostic output. More...

Collaboration diagram for Logging:

Detailed Description

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. More...
 
void warnlog (const string &warning, const string &msg)
 Write a warning message to the screen. More...
 
void setLogger (Logger *logwriter)
 Install a logger. More...
 
void writelog_direct (const string &msg)
 Write a message to the screen. More...
 
void debuglog (const string &msg, int loglevel)
 Write a message to the log only if loglevel > 0. More...
 
template<typename... Args>
void writelog (const string &fmt, const Args &... args)
 Write a formatted message to the screen. More...
 
template<typename... Args>
void writelogf (const char *fmt, const Args &... args)
 Write a formatted message to the screen. More...
 
void writelogendl ()
 Write an end of line character to the screen and flush output. More...
 
void writeline (char repeat, size_t count, bool endl_after, bool endl_before)
 
void setLogger (Logger *logwriter)
 Install a logger. More...
 

Function Documentation

◆ writelog() [1/2]

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.

Parameters
msgc++ string to be written to the screen

Definition at line 69 of file application.cpp.

◆ warnlog()

void warnlog ( const string &  warning,
const string &  msg 
)

Write a warning message to the screen.

Parameters
warningString specifying type of warning; see Logger::warn()
msgString to be written to the screen

Definition at line 79 of file application.cpp.

◆ setLogger() [1/2]

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

Parameters
logwriterPointer to a logger object
See also
Logger.

Definition at line 64 of file application.cpp.

◆ writelog_direct()

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.

Parameters
msgc++ string to be written to the screen

Definition at line 36 of file global.cpp.

◆ debuglog()

void Cantera::debuglog ( const string &  msg,
int  loglevel 
)
inline

Write a message to the log only if loglevel > 0.

Definition at line 158 of file global.h.

◆ writelog() [2/2]

void Cantera::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.

Definition at line 175 of file global.h.

◆ writelogf()

void Cantera::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().

Parameters
fmtc format string for the following arguments
argsarguments used to interpolate the format string

Definition at line 195 of file global.h.

◆ writelogendl()

void writelogendl ( )

Write an end of line character to the screen and flush output.

Definition at line 41 of file global.cpp.

◆ setLogger() [2/2]

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

Parameters
logwriterPointer to a logger object
See also
Logger.

Definition at line 27 of file global.cpp.