Cantera 2.6.0

Classes | Functions
Writing messages to the screen
Diagnostic Output
Collaboration diagram for Writing messages to the screen:

## Classes
class | Application
| Class to hold global data. 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 std::string &msg)
| Write a message to the screen. More...
void | warnlog (const std::string &warning, const std::string &msg)
| Write a warning message to the screen. More...
void | setLogger (Logger *logwriter)
| Install a logger. More...
template<typename... Args>
void | writelog (const std::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...

## Detailed Description

## Function Documentation

## ◆ writelog() [1/2]

void writelog | ( | const std::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

  msg | c++ string to be written to the screen

Definition at line 90 of file application.cpp.

Referenced by Application::writelog().

## ◆ warnlog()

void warnlog | ( | const std::string & | warning,
|  | const std::string & | msg
| ) |  |

Write a warning message to the screen.

Parameters

  warning | String specifying type of warning;

See also
  Logger::warn

Parameters

  msg | String to be written to the screen

Definition at line 100 of file application.cpp.

Referenced by Application::warnlog().

## ◆ setLogger()

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

  logwriter | Pointer to a logger object

See also
  Logger.

Definition at line 85 of file application.cpp.

Referenced by Application::setLogger().

## ◆ writelog() [2/2]

void writelog | ( | const std::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 164 of file global.h.

References Cantera::writelog_direct().

Referenced by Cantera::BasisOptimize(), Cantera::ck2cti(), MultiNewton::dampStep(), ChemEquil::dampStep(), Cantera::ElemRearrange(), ChemEquil::equilibrate(), ChemEquil::equilResidual(), ChemEquil::estimateElementPotentials(), FuncEval::eval_nothrow(), GasTransport::fitCollisionIntegrals(), GasTransport::fitDiffCoeffs(), IonGasTransport::fitDiffCoeffs(), GasTransport::fitProperties(), Cantera::getFloatArray(), Cantera::getInteger(), MMCollisionInt::init(), solveSP::print_header(), HMWSoln::printCoeffs(), solveSP::printIteration(), Sim1D::refine(), StFlow::restore(), ChemEquil::setInitialMoles(), Inlet1D::showSolution(), Surf1D::showSolution(), ReactingSurf1D::showSolution(), Domain1D::showSolution(), StFlow::showSolution(), MultiNewton::solve(), solveSP::solveSurfProb(), OneDim::timeStep(), VCS_SOLVE::vcs_basopt(), ResidEval::writeSolution(), and OneDim::writeStats().

## ◆ writelogf()

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().

Parameters

  fmt | c format string for the following arguments
  args | arguments used to interpolate the format string

Definition at line 185 of file global.h.

References Cantera::writelog_direct().

Referenced by Cantera::BasisOptimize(), ChemEquil::dampStep(), Cantera::ElemRearrange(), ChemEquil::equilibrate(), ChemEquil::equilResidual(), ChemEquil::estimateElementPotentials(), GasTransport::fitDiffCoeffs(), IonGasTransport::fitDiffCoeffs(), GasTransport::fitProperties(), MMCollisionInt::init(), solveSP::print_header(), HMWSoln::printCoeffs(), solveSP::printIteration(), ChemEquil::setInitialMoles(), solveSP::solveSurfProb(), and ResidEval::writeSolution().