The class was missing the implementation of writeendl, which caused the base class method to be called, occasionally leading to confusing test failures. Not setting the mode of the output file caused it not to be automatically created, so the log file usually wasn't even being written.
27 lines
479 B
C++
27 lines
479 B
C++
#include "cantera/base/logger.h"
|
|
|
|
#include <fstream>
|
|
|
|
class fileLog: public Cantera::Logger
|
|
{
|
|
public:
|
|
explicit fileLog(const std::string& fName) {
|
|
m_fName = fName;
|
|
m_fs.open(fName.c_str(), std::ios::out);
|
|
}
|
|
|
|
virtual void write(const std::string& msg) {
|
|
m_fs << msg;
|
|
}
|
|
|
|
virtual void writeendl() {
|
|
m_fs << std::endl;
|
|
}
|
|
|
|
virtual ~fileLog() {
|
|
m_fs.close();
|
|
}
|
|
|
|
std::string m_fName;
|
|
std::fstream m_fs;
|
|
};
|