YggdrasilWM
0.1.1
A tiny window manager coded in C++
|
Logger class This class is responsible for logging. It can be created with a file name or an ostream. The log level can be set to filter the messages. More...
#include <Logger.hpp>
Public Member Functions | |
Logger (const Logger &)=delete | |
Logger & | operator= (const Logger &)=delete |
virtual | ~Logger () |
Destroy the Logger:: Logger object closes the log file if it was opened. The destructor is virtual to allow for subclassing.for gmock. More... | |
virtual void | Log (const std::string &message, LogLevel level) const |
Log a message This method logs a message to the log file or stream. The message is only logged if the log level is high enough. the time and log level are prepended to the message. The method is virtual to allow for subclassing.for gmock. More... | |
Static Public Member Functions | |
static void | Create (const std::string &logFile, LogLevel logLevel) |
static void | Create (std::ostream &output, LogLevel logLevel) |
static Logger * | GetInstance () |
Get the Logger object. More... | |
static void | Destroy () |
Destroy the Logger:: Logger object closes the log file if it was opened. More... | |
Private Member Functions | |
Logger (const std::string &logFile, LogLevel logLevel) | |
Construct a new Logger:: Logger object This constructor is used when the user wants to log to a file. More... | |
Logger (std::ostream &output, LogLevel logLevel) | |
Construct a new Logger:: Logger object This constructor is used when the user wants to log to a stream. More... | |
Static Private Member Functions | |
static std::string | GetLogLevel (LogLevel level) |
Get the log level as a string. More... | |
static std::string | GetTime () |
Get the current time. More... | |
Private Attributes | |
bool | streamIsFile_ |
std::ostream * | logStream_ |
LogLevel | logLevel_ |
Static Private Attributes | |
static Logger * | instance_ = nullptr |
Logger class This class is responsible for logging. It can be created with a file name or an ostream. The log level can be set to filter the messages.
|
delete |
|
virtual |
Destroy the Logger:: Logger object closes the log file if it was opened. The destructor is virtual to allow for subclassing.for gmock.
References GetTime(), logStream_, and streamIsFile_.
|
private |
Construct a new Logger:: Logger object This constructor is used when the user wants to log to a file.
logFile | the file to log to |
logLevel | level of logging 0: info, 1: warning, 2: error |
References logStream_, and streamIsFile_.
|
private |
Construct a new Logger:: Logger object This constructor is used when the user wants to log to a stream.
output | the stream to log to |
logLevel | level of logging 0: info, 1: warning, 2: error |
References streamIsFile_.
|
static |
|
static |
|
static |
|
static |
Get the Logger object.
References instance_.
Referenced by WindowManager::addGroupsFromConfig(), Bar::addWidget(), Client::Client(), ConfigFileHandler::ConfigFileHandler(), ConfigHandler::configInit(), ConfigDataBar::configInit(), ConfigDataGroup::configInit(), ConfigDataGroups::configInit(), ConfigDataWidget::configInit(), ConfigDataBars::configInit(), ConfigDataBindings::configInit(), WindowManager::create(), EventHandler::dispatchEvent(), FocusGroup::execute(), Spawn::execute(), Client::frame(), WindowManager::getTopLevelWindows(), Bars::getWidgetTypeHandle(), Group::Group(), EventHandler::handleButtonPress(), EventHandler::handleDestroyNotify(), EventHandler::handleFocusIn(), EventHandler::handleFocusOut(), ConfigDataBindings::handleKeypressEvent(), EventHandler::handleMapNotify(), EventHandler::handleMapRequest(), ewmh::handleMessage(), EventHandler::handlePropertyNotify(), EventHandler::handleUnmapNotify(), Bars::init(), Binding::init_keycode(), ewmh::initEwmh(), WindowManager::insertClient(), main(), Client::move(), Group::moveClientToGroup(), WindowManager::OnXError(), ConfigFileHandler::readConfig(), Group::removeClient(), Client::resize(), Client::restack(), Bars::run(), WindowManager::Run(), Group::switchFrom(), Group::switchTo(), Client::unframe(), ewmh::updateDesktopGeometry(), ConfigFileHandler::writeConfig(), Bars::~Bars(), Client::~Client(), and WindowManager::~WindowManager().
|
staticprivate |
|
staticprivate |
|
virtual |
Log a message This method logs a message to the log file or stream. The message is only logged if the log level is high enough. the time and log level are prepended to the message. The method is virtual to allow for subclassing.for gmock.
message | the message to log |
level | the level of the message |
References GetLogLevel(), GetTime(), logLevel_, and logStream_.
Referenced by WindowManager::addGroupsFromConfig(), Bar::addWidget(), Client::Client(), ConfigFileHandler::ConfigFileHandler(), ConfigHandler::configInit(), ConfigDataBar::configInit(), ConfigDataGroup::configInit(), ConfigDataGroups::configInit(), ConfigDataWidget::configInit(), ConfigDataBars::configInit(), ConfigDataBindings::configInit(), WindowManager::create(), EventHandler::dispatchEvent(), FocusGroup::execute(), Spawn::execute(), Client::frame(), WindowManager::getTopLevelWindows(), Bars::getWidgetTypeHandle(), Group::Group(), EventHandler::handleButtonPress(), EventHandler::handleDestroyNotify(), EventHandler::handleFocusIn(), EventHandler::handleFocusOut(), ConfigDataBindings::handleKeypressEvent(), EventHandler::handleMapNotify(), EventHandler::handleMapRequest(), ewmh::handleMessage(), EventHandler::handlePropertyNotify(), EventHandler::handleUnmapNotify(), Bars::init(), Binding::init_keycode(), ewmh::initEwmh(), WindowManager::insertClient(), main(), Client::move(), Group::moveClientToGroup(), WindowManager::OnXError(), ConfigFileHandler::readConfig(), Group::removeClient(), Client::resize(), Client::restack(), Bars::run(), WindowManager::Run(), Group::switchFrom(), Group::switchTo(), Client::unframe(), ewmh::updateDesktopGeometry(), ConfigFileHandler::writeConfig(), Bars::~Bars(), Client::~Client(), and WindowManager::~WindowManager().
|
staticprivate |
Referenced by Create(), Destroy(), and GetInstance().