NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
This class represents a simple logging functionality, which might be extended in the future to handle more generic logging formats. More...
#include <logger.hpp>
Public Types | |
enum | LogLevel { LVL_DEBUG , LVL_INFO , LVL_CMDLINE , LVL_WARNING , LVL_ERROR , LVL_DISABLED } |
Public Member Functions | |
Logger () | |
Empty default constructor. More... | |
Logger (const std::string &sLogFile) | |
Generic constructor. Will open the target file, if possible. More... | |
bool | open (const std::string &sLogFile) |
Open the target logging file for writing. More... | |
void | close () |
Close the logger stream. More... | |
bool | is_open () const |
Check, whether the logger stream is currently open. More... | |
void | push (const std::string &sMessage) |
Push a message to the logger stream. Will automatically re-open a file, if the stream had been closed. More... | |
void | push_line (const std::string &sMessage) |
Push a line to the logger stream. The stream will automatically append the line termination characters. More... | |
Private Member Functions | |
bool | ensure_open () |
Ensures that the stream is open and tries to re-open it otherwise. More... | |
Private Attributes | |
std::ofstream | m_logFile |
std::string | m_sLogFile |
This class represents a simple logging functionality, which might be extended in the future to handle more generic logging formats.
Definition at line 32 of file logger.hpp.
enum Logger::LogLevel |
Enumerator | |
---|---|
LVL_DEBUG | |
LVL_INFO | |
LVL_CMDLINE | |
LVL_WARNING | |
LVL_ERROR | |
LVL_DISABLED |
Definition at line 51 of file logger.hpp.
Logger::Logger | ( | ) |
Empty default constructor.
Definition at line 71 of file logger.cpp.
Logger::Logger | ( | const std::string & | sLogFile | ) |
Generic constructor. Will open the target file, if possible.
sLogFile | const std::string& |
Definition at line 84 of file logger.cpp.
References open().
void Logger::close | ( | ) |
Close the logger stream.
Definition at line 118 of file logger.cpp.
References m_logFile.
Referenced by Script::close(), Script::getNextScriptCommandFromScript(), and Script::returnCommand().
|
private |
Ensures that the stream is open and tries to re-open it otherwise.
Definition at line 144 of file logger.cpp.
References m_logFile, and m_sLogFile.
Referenced by push(), and push_line().
bool Logger::is_open | ( | ) | const |
Check, whether the logger stream is currently open.
Definition at line 131 of file logger.cpp.
References m_logFile.
Referenced by Script::close(), Script::getNextScriptCommandFromScript(), DetachedLogger::is_buffering(), and Script::returnCommand().
bool Logger::open | ( | const std::string & | sLogFile | ) |
Open the target logging file for writing.
sLogFile | const std::string& |
Definition at line 100 of file logger.cpp.
References m_logFile, and m_sLogFile.
Referenced by Logger(), DetachedLogger::open(), and Script::startInstallation().
void Logger::push | ( | const std::string & | sMessage | ) |
Push a message to the logger stream. Will automatically re-open a file, if the stream had been closed.
sMessage | const std::string& |
Definition at line 162 of file logger.cpp.
References ensure_open(), and m_logFile.
Referenced by Script::close(), Script::getNextScriptCommandFromScript(), and Script::returnCommand().
void Logger::push_line | ( | const std::string & | sMessage | ) |
Push a line to the logger stream. The stream will automatically append the line termination characters.
sMessage | const std::string& |
Definition at line 178 of file logger.cpp.
References ensure_open(), and m_logFile.
Referenced by Script::evaluateInstallInformation(), Script::getNextScriptCommandFromScript(), DetachedLogger::open(), DetachedLogger::push_info(), Script::startInstallation(), Script::writeLayout(), Script::writeProcedure(), and Script::writeWholeFile().
|
private |
Definition at line 35 of file logger.hpp.
Referenced by close(), ensure_open(), is_open(), open(), push(), and push_line().
|
private |
Definition at line 36 of file logger.hpp.
Referenced by ensure_open(), and open().