mirror of
https://github.com/debauchee/barrier.git
synced 2025-06-26 22:47:05 +02:00
Fixed issue 506 - plus some quite major refactoring
This commit is contained in:
parent
a19e800b99
commit
24765e6891
8 changed files with 50 additions and 60 deletions
|
@ -252,30 +252,25 @@ CBufferedLogOutputter::write(ELevel, const char* message)
|
|||
// CFileLogOutputter
|
||||
//
|
||||
|
||||
CFileLogOutputter::CFileLogOutputter(const char * logFile)
|
||||
CFileLogOutputter::CFileLogOutputter(const char* logFile)
|
||||
{
|
||||
assert(logFile != NULL);
|
||||
|
||||
m_handle.open(logFile, std::fstream::app);
|
||||
// open file handle
|
||||
m_fileName = logFile;
|
||||
}
|
||||
|
||||
CFileLogOutputter::~CFileLogOutputter()
|
||||
{
|
||||
// close file handle
|
||||
if (m_handle.is_open())
|
||||
m_handle.close();
|
||||
}
|
||||
|
||||
bool
|
||||
CFileLogOutputter::write(ILogOutputter::ELevel level, const char *message)
|
||||
{
|
||||
std::ofstream m_handle;
|
||||
m_handle.open(m_fileName.c_str(), std::fstream::app);
|
||||
if (m_handle.is_open() && m_handle.fail() != true) {
|
||||
m_handle << message << std::endl;
|
||||
|
||||
// write buffer to file
|
||||
m_handle.flush();
|
||||
}
|
||||
m_handle.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue