NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
This class is a specialisation of the Logger to run detached, i.e. as a global instance usable form everywhere. More...
#include <logger.hpp>
Public Member Functions | |
DetachedLogger (Logger::LogLevel lvl=Logger::LVL_INFO) | |
DetachedLogger constructor. Sets the default logging level. More... | |
~DetachedLogger () | |
DetachedLogger destructor. Appends a terminating message to the current logfile (if any). More... | |
bool | is_buffering () const |
Determine, whether this instance is currently buffering or directly writing to a file. More... | |
bool | open (const std::string &sLogFile) |
Open the log file and push the buffered messages directly to this file. More... | |
void | setLoggingLevel (Logger::LogLevel lvl) |
Change the logging level or completely disable the logger. More... | |
void | push_info (const std::string &sInfo) |
Push a message to the logger, which is not dependend on the logging level and will be shown without a timestamp. More... | |
void | write_system_information () |
A helper function to write the current OS's information to the log file. More... | |
void | push_line (Logger::LogLevel lvl, const std::string &sMessage) |
Push a message with the corresponding logging level to the logger. The message will be prefixed with the millisecond-precise timestamp. More... | |
void | debug (const std::string &sMessage) |
Convenience member function. More... | |
void | info (const std::string &sMessage) |
Convenience member function. More... | |
void | cmdline (const std::string &sMessage) |
Convenience member function. More... | |
void | warning (const std::string &sMessage) |
Convenience member function. More... | |
void | error (const std::string &sMessage) |
Convenience member function. More... | |
Public Member Functions inherited from Logger | |
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 Attributes | |
std::vector< std::string > | m_buffer |
Logger::LogLevel | m_level |
Additional Inherited Members | |
Public Types inherited from Logger | |
enum | LogLevel { LVL_DEBUG , LVL_INFO , LVL_CMDLINE , LVL_WARNING , LVL_ERROR , LVL_DISABLED } |
This class is a specialisation of the Logger to run detached, i.e. as a global instance usable form everywhere.
Definition at line 69 of file logger.hpp.
DetachedLogger::DetachedLogger | ( | Logger::LogLevel | lvl = Logger::LVL_INFO | ) |
DetachedLogger constructor. Sets the default logging level.
lvl | Logger::LogLevel |
Definition at line 197 of file logger.cpp.
DetachedLogger::~DetachedLogger | ( | ) |
DetachedLogger destructor. Appends a terminating message to the current logfile (if any).
Definition at line 208 of file logger.cpp.
References push_info().
|
inline |
Convenience member function.
sMessage | const std::string& |
Definition at line 118 of file logger.hpp.
References Logger::LVL_CMDLINE, and push_line().
Referenced by NumeReKernel::MainLoop().
|
inline |
Convenience member function.
sMessage | const std::string& |
Definition at line 94 of file logger.hpp.
References Logger::LVL_DEBUG, and push_line().
Referenced by NumeReKernel::clcTerminal(), NumeReWindow::CloseAllFiles(), Archive::detectType(), evalMatOp(), getIndices(), EditorNotebook::GetTabFromPoint(), NumeReKernel::initializeStackTracker(), NumeReWindow::NumeReWindow(), NumeReWindow::OnFileEventTimer(), MyApp::OnInit(), EditorNotebook::OnTabRightClicked(), NumeRe::FileAdapter::openFile(), Archive::pack(), performMatrixOperation(), readImage(), NumeReKernel::refreshFunctionTree(), rotateTable(), NumeReKernel::showDebugEvent(), NumeReKernel::StartUp(), Archive::unpack(), NumeReKernel::updateLineLenght(), and NumeReKernel::waitForContinue().
|
inline |
Convenience member function.
sMessage | const std::string& |
Definition at line 142 of file logger.hpp.
References Logger::LVL_ERROR, and push_line().
Referenced by NumeReKernel::MainLoop(), and MyApp::OnExceptionInMainLoop().
|
inline |
Convenience member function.
sMessage | const std::string& |
Definition at line 106 of file logger.hpp.
References Logger::LVL_INFO, and push_line().
Referenced by NumeReKernel::Autosave(), NumeReWindow::CloseAllFiles(), NumeReWindow::CloseFile(), NumeReKernel::CloseSession(), determineWindowSize(), NumeReWindow::EvaluateCommandLine(), NumeRe::StringVarFactory::evaluateStringVectors(), Procedure::execute(), NumeReWindow::LoadFilesToTree(), NumeReWindow::NumeReWindow(), NumeReWindow::OnClose(), NumeReWindow::OnFileEventTimer(), MyApp::OnInit(), NumeRe::FileAdapter::openFile(), NumeReWindow::OpenSourceFile(), NumeReWindow::prepareSession(), readAudioFile(), readImage(), NumeReWindow::refreshFunctionTree(), NumeReWindow::reloadFileIfOpen(), NumeReKernel::saveData(), seekInAudioFile(), and NumeReKernel::StartUp().
bool DetachedLogger::is_buffering | ( | ) | const |
Determine, whether this instance is currently buffering or directly writing to a file.
Definition at line 223 of file logger.cpp.
References Logger::is_open().
Referenced by push_info().
bool DetachedLogger::open | ( | const std::string & | sLogFile | ) |
Open the log file and push the buffered messages directly to this file.
sLogFile | const std::string& |
Definition at line 237 of file logger.cpp.
References m_buffer, Logger::open(), and Logger::push_line().
Referenced by NumeReKernel::StartUp().
void DetachedLogger::push_info | ( | const std::string & | sInfo | ) |
Push a message to the logger, which is not dependend on the logging level and will be shown without a timestamp.
sInfo | const std::string& |
Definition at line 276 of file logger.cpp.
References is_buffering(), m_buffer, and Logger::push_line().
Referenced by MyApp::OnInit(), push_line(), write_system_information(), and ~DetachedLogger().
void DetachedLogger::push_line | ( | Logger::LogLevel | lvl, |
const std::string & | sMessage | ||
) |
Push a message with the corresponding logging level to the logger. The message will be prefixed with the millisecond-precise timestamp.
lvl | Logger::LogLevel |
sMessage | const std::string& |
Definition at line 318 of file logger.cpp.
References GET_MILLISECONDS, Logger::LVL_CMDLINE, Logger::LVL_DEBUG, Logger::LVL_DISABLED, Logger::LVL_ERROR, Logger::LVL_INFO, Logger::LVL_WARNING, m_level, push_info(), sys_time_now(), and toString().
Referenced by cmdline(), debug(), error(), info(), and warning().
void DetachedLogger::setLoggingLevel | ( | Logger::LogLevel | lvl | ) |
Change the logging level or completely disable the logger.
lvl | Logger::LogLevel |
Definition at line 261 of file logger.cpp.
References m_level.
Referenced by cmd_set(), MyApp::OnInit(), and NumeReKernel::StartUp().
|
inline |
Convenience member function.
sMessage | const std::string& |
Definition at line 130 of file logger.hpp.
References Logger::LVL_WARNING, and push_line().
Referenced by NumeRe::StringParser::createStack(), NumeReKernel::issueWarning(), NumeReKernel::MainLoop(), and MyApp::OnInit().
void DetachedLogger::write_system_information | ( | ) |
A helper function to write the current OS's information to the log file.
Definition at line 292 of file logger.cpp.
References IsWow64(), push_info(), and toString().
Referenced by MyApp::OnInit().
|
private |
Definition at line 72 of file logger.hpp.
Referenced by open(), and push_info().
|
private |
Definition at line 73 of file logger.hpp.
Referenced by push_line(), and setLoggingLevel().