OpenWalnut
1.5.0dev
|
A wrapper for WLogger. More...
#include <WLoggerWrapper.h>
Classes | |
struct | FileStreamEntry |
A helper class for storing information about file streams that we added to the logger. More... | |
Public Member Functions | |
WLoggerWrapper () | |
Constructor. More... | |
WLoggerWrapper (WLogger *logger) | |
Constructor. More... | |
~WLoggerWrapper () | |
Destructor. More... | |
bool | addFileStream (std::string filename) |
Add a file to which the logger output will be written. More... | |
bool | removeFileStream (std::string filename) |
Remove a file to which the logger writes. More... | |
void | removeAllFileStreams () |
Remove all files to which the logger writes (and which were added by this wrapper). More... | |
void | error (std::string const &location, std::string const &message) |
Output an error to the logs. More... | |
void | warning (std::string const &location, std::string const &message) |
Output a warning to the logs. More... | |
void | info (std::string const &location, std::string const &message) |
Output information to the logs. More... | |
void | debug (std::string const &location, std::string const &message) |
Output a debug message. More... | |
Private Member Functions | |
void | removeFileStreamNumber (size_t i) |
Helper function that removes the file stream with the given index. More... | |
Private Attributes | |
WLogger * | m_logger |
A pointer to the logger. More... | |
std::vector< FileStreamEntry > | m_fileStreamList |
List of file streams. More... | |
A wrapper for WLogger.
This is used to expose a part of the WLogger functionality to script interpreters.
Definition at line 43 of file WLoggerWrapper.h.
WLoggerWrapper::WLoggerWrapper | ( | ) |
|
explicit |
Constructor.
logger | A pointer to a logger instance. |
Definition at line 39 of file WLoggerWrapper.cpp.
References m_logger.
WLoggerWrapper::~WLoggerWrapper | ( | ) |
Destructor.
Definition at line 45 of file WLoggerWrapper.cpp.
References removeAllFileStreams().
bool WLoggerWrapper::addFileStream | ( | std::string | filename | ) |
Add a file to which the logger output will be written.
filename | The name of the file to write logging stuff into. |
Definition at line 56 of file WLoggerWrapper.cpp.
References WLogger::addStream(), WLoggerWrapper::FileStreamEntry::m_filename, WLoggerWrapper::FileStreamEntry::m_fileStream, m_fileStreamList, m_logger, and WLoggerWrapper::FileStreamEntry::m_WLogStream.
void WLoggerWrapper::debug | ( | std::string const & | location, |
std::string const & | message | ||
) |
Output a debug message.
location | A string indicating where the message is from. |
message | The debug message. |
Definition at line 108 of file WLoggerWrapper.cpp.
References WLogger::addLogMessage(), and m_logger.
void WLoggerWrapper::error | ( | std::string const & | location, |
std::string const & | message | ||
) |
Output an error to the logs.
location | A string indicating where the error occured. |
message | A message indicating what happened. |
Definition at line 93 of file WLoggerWrapper.cpp.
References WLogger::addLogMessage(), and m_logger.
void WLoggerWrapper::info | ( | std::string const & | location, |
std::string const & | message | ||
) |
Output information to the logs.
location | A string indicating where the info is from. |
message | The information. |
Definition at line 103 of file WLoggerWrapper.cpp.
References WLogger::addLogMessage(), and m_logger.
void WLoggerWrapper::removeAllFileStreams | ( | ) |
Remove all files to which the logger writes (and which were added by this wrapper).
Definition at line 85 of file WLoggerWrapper.cpp.
References m_fileStreamList, and removeFileStreamNumber().
Referenced by ~WLoggerWrapper().
bool WLoggerWrapper::removeFileStream | ( | std::string | filename | ) |
Remove a file to which the logger writes.
filename | The name of the file to remove. |
Definition at line 72 of file WLoggerWrapper.cpp.
References m_fileStreamList, and removeFileStreamNumber().
|
private |
Helper function that removes the file stream with the given index.
i | The index of the stream to remove. |
Definition at line 50 of file WLoggerWrapper.cpp.
References m_fileStreamList, m_logger, and WLogger::removeStream().
Referenced by removeAllFileStreams(), and removeFileStream().
void WLoggerWrapper::warning | ( | std::string const & | location, |
std::string const & | message | ||
) |
Output a warning to the logs.
location | A string indicating where the problem occured. |
message | A message indicating what happened. |
Definition at line 98 of file WLoggerWrapper.cpp.
References WLogger::addLogMessage(), and m_logger.
|
private |
List of file streams.
Definition at line 146 of file WLoggerWrapper.h.
Referenced by addFileStream(), removeAllFileStreams(), removeFileStream(), and removeFileStreamNumber().
|
private |
A pointer to the logger.
Definition at line 143 of file WLoggerWrapper.h.
Referenced by addFileStream(), debug(), error(), info(), removeFileStreamNumber(), warning(), and WLoggerWrapper().