| Cantera 3.0.0

Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
ExternalLogger Class Reference
Errors and Diagnostics » Logging

Logger that delegates to an external source via a callback to produce log output. More...

`#include <ExternalLogger.h>`

Inheritance diagram for ExternalLogger:
[legend]

## Detailed Description

Logger that delegates to an external source via a callback to produce log output.

Definition at line 13 of file ExternalLogger.h.

## Public Member Functions
| ExternalLogger (LogCallback writer)
void | write (const string &msg) override
| Write a log message.
void | writeendl () override
| Write an end of line character and flush output.
void | warn (const string &warning, const string &msg) override
| Write a warning message.
void | error (const string &msg) override
| Write an error message and quit.
Public Member Functions inherited from Logger
| Logger ()
| Constructor - empty.
virtual | ~Logger ()
| Destructor - empty.

## Private Attributes
string | m_writeBuffer
LogCallback | m_writer = nullptr

## Constructor & Destructor Documentation

## ◆ ExternalLogger()

ExternalLogger | ( | LogCallback | writer | ) |
| inline explicit

Definition at line 16 of file ExternalLogger.h.

## Member Function Documentation

## ◆ write()

void write | ( | const string & | msg | ) |
| inline override virtual

Write a log message.

The default behavior is to write to the standard output. Note that no end-of-line character is appended to the message, and so if one is desired it must be included in the string.

Parameters

  msg | String message to be written to cout

Reimplemented from Logger.

Definition at line 25 of file ExternalLogger.h.

## ◆ writeendl()

void writeendl | ( |  | ) |
| inline override virtual

Write an end of line character and flush output.

Some systems treat endl and
differently. The endl statement causes a flushing of stdout to the screen.

Reimplemented from Logger.

Definition at line 41 of file ExternalLogger.h.

## ◆ warn()

void warn | ( | const string & | warning,
|  | const string & | msg
| ) |  |
| inline override virtual

Write a warning message.

The default behavior is to write to the logging output.

Parameters

  warning | String specifying type of warning
  msg | String message to be written to cout

Reimplemented from Logger.

Definition at line 47 of file ExternalLogger.h.

## ◆ error()

void error | ( | const string & | msg | ) |
| inline override virtual

Write an error message and quit.

The default behavior is to write to the standard error stream, and then call exit(). Note that no end-of-line character is appended to the message, and so if one is desired it must be included in the string. Note that this default behavior will terminate the application Cantera is invoked from (MATLAB, Excel, etc.) If this is not desired, then derive a class and reimplement this method.

Parameters

  msg | Error message to be written to cerr.

Reimplemented from Logger.

Definition at line 51 of file ExternalLogger.h.

## Member Data Documentation

## ◆ m_writeBuffer

string m_writeBuffer
| private

Definition at line 56 of file ExternalLogger.h.

## ◆ m_writer

LogCallback m_writer = nullptr
| private

Definition at line 58 of file ExternalLogger.h.

The documentation for this class was generated from the following file:

- ExternalLogger.h