4#ifndef CT_EXTERNAL_LOGGER_H
5#define CT_EXTERNAL_LOGGER_H
17 if (writer ==
nullptr) {
19 "Argument “writer” must not be null!");
25 void write(
const string& msg)
override {
26 m_writeBuffer.append(msg);
28 if (!m_writeBuffer.empty() && m_writeBuffer.back() ==
'\n') {
33 m_writeBuffer.pop_back();
35 m_writer(LogLevel::INFO,
"Info", m_writeBuffer.c_str());
37 m_writeBuffer.erase();
42 m_writer(LogLevel::INFO,
"Info", m_writeBuffer.c_str());
44 m_writeBuffer.erase();
47 void warn(
const string& warning,
const string& msg)
override {
48 m_writer(LogLevel::WARN, warning.c_str(), msg.c_str());
51 void error(
const string& msg)
override {
52 m_writer(LogLevel::ERROR,
"Error", msg.c_str());
Base class for exceptions thrown by Cantera classes.
Logger that delegates to an external source via a callback to produce log output.
void writeendl() override
Write an end of line character and flush output.
void write(const string &msg) override
Write a log message.
void error(const string &msg) override
Write an error message and quit.
void warn(const string &warning, const string &msg) override
Write a warning message.
Base class for 'loggers' that write text messages to log files.
void(* LogCallback)(enum LogLevel logLevel, const char *category, const char *message)
Represents a callback that is invoked to produce log output.
Header for Base class for 'loggers' that write text messages to log files (see Logging and class Logg...
Namespace for the Cantera kernel.