OpenWalnut  1.5.0dev
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
WLoggerWrapper Class Reference

A wrapper for WLogger. More...

#include <WLoggerWrapper.h>

+ Collaboration diagram for WLoggerWrapper:

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

WLoggerm_logger
 A pointer to the logger. More...
 
std::vector< FileStreamEntrym_fileStreamList
 List of file streams. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ WLoggerWrapper() [1/2]

WLoggerWrapper::WLoggerWrapper ( )

Constructor.

Creates an empty wrapper.

Definition at line 35 of file WLoggerWrapper.cpp.

◆ WLoggerWrapper() [2/2]

WLoggerWrapper::WLoggerWrapper ( WLogger logger)
explicit

Constructor.

Parameters
loggerA pointer to a logger instance.

Definition at line 39 of file WLoggerWrapper.cpp.

References m_logger.

◆ ~WLoggerWrapper()

WLoggerWrapper::~WLoggerWrapper ( )

Destructor.

Definition at line 45 of file WLoggerWrapper.cpp.

References removeAllFileStreams().

+ Here is the call graph for this function:

Member Function Documentation

◆ addFileStream()

bool WLoggerWrapper::addFileStream ( std::string  filename)

Add a file to which the logger output will be written.

Parameters
filenameThe name of the file to write logging stuff into.
Returns
true, if a stream to that file could be created and added successfully.

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.

+ Here is the call graph for this function:

◆ debug()

void WLoggerWrapper::debug ( std::string const &  location,
std::string const &  message 
)

Output a debug message.

Parameters
locationA string indicating where the message is from.
messageThe debug message.

Definition at line 108 of file WLoggerWrapper.cpp.

References WLogger::addLogMessage(), and m_logger.

+ Here is the call graph for this function:

◆ error()

void WLoggerWrapper::error ( std::string const &  location,
std::string const &  message 
)

Output an error to the logs.

Parameters
locationA string indicating where the error occured.
messageA message indicating what happened.

Definition at line 93 of file WLoggerWrapper.cpp.

References WLogger::addLogMessage(), and m_logger.

+ Here is the call graph for this function:

◆ info()

void WLoggerWrapper::info ( std::string const &  location,
std::string const &  message 
)

Output information to the logs.

Parameters
locationA string indicating where the info is from.
messageThe information.

Definition at line 103 of file WLoggerWrapper.cpp.

References WLogger::addLogMessage(), and m_logger.

+ Here is the call graph for this function:

◆ removeAllFileStreams()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeFileStream()

bool WLoggerWrapper::removeFileStream ( std::string  filename)

Remove a file to which the logger writes.

Parameters
filenameThe name of the file to remove.
Returns
true, if a stream to that file existed and was removed successfully.

Definition at line 72 of file WLoggerWrapper.cpp.

References m_fileStreamList, and removeFileStreamNumber().

+ Here is the call graph for this function:

◆ removeFileStreamNumber()

void WLoggerWrapper::removeFileStreamNumber ( size_t  i)
private

Helper function that removes the file stream with the given index.

Parameters
iThe 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ warning()

void WLoggerWrapper::warning ( std::string const &  location,
std::string const &  message 
)

Output a warning to the logs.

Parameters
locationA string indicating where the problem occured.
messageA message indicating what happened.

Definition at line 98 of file WLoggerWrapper.cpp.

References WLogger::addLogMessage(), and m_logger.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_fileStreamList

std::vector< FileStreamEntry > WLoggerWrapper::m_fileStreamList
private

List of file streams.

Definition at line 146 of file WLoggerWrapper.h.

Referenced by addFileStream(), removeAllFileStreams(), removeFileStream(), and removeFileStreamNumber().

◆ m_logger

WLogger* WLoggerWrapper::m_logger
private

A pointer to the logger.

Definition at line 143 of file WLoggerWrapper.h.

Referenced by addFileStream(), debug(), error(), info(), removeFileStreamNumber(), warning(), and WLoggerWrapper().


The documentation for this class was generated from the following files: