MyGUI_LogSource.cpp
Go to the documentation of this file.
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#include "MyGUI_Precompiled.h"
#include "MyGUI_LogSource.h"
namespace MyGUI
{
void LogSource::setLogFilter(ILogFilter* _filter)
{
mFilter = _filter;
}
void LogSource::addLogListener(ILogListener* _lestener)
{
mListeners.push_back(_lestener);
}
void LogSource::open()
{
for (auto& listener : mListeners)
listener->open();
}
void LogSource::close()
{
for (auto& listener : mListeners)
listener->close();
}
void LogSource::flush()
{
for (auto& listener : mListeners)
listener->flush();
}
void LogSource::log(
std::string_view _section,
LogLevel _level,
const struct tm* _time,
std::string_view _message,
std::string_view _file,
int _line)
{
if (mFilter != nullptr)
{
if (!mFilter->shouldLog(_section, _level, _time, _message, _file, _line))
return;
}
for (auto& listener : mListeners)
listener->log(_section, _level, _time, _message, _file, _line);
}
} // namespace MyGUI
MyGUI_LogSource.h
MyGUI_Precompiled.h
MyGUI::ILogFilter
Definition MyGUI_ILogFilter.h:17
MyGUI::ILogListener
Definition MyGUI_ILogListener.h:17
MyGUI::LogSource::setLogFilter
void setLogFilter(ILogFilter *_filter)
Definition MyGUI_LogSource.cpp:13
MyGUI::LogSource::close
void close()
Definition MyGUI_LogSource.cpp:29
MyGUI::LogSource::flush
void flush()
Definition MyGUI_LogSource.cpp:35
MyGUI::LogSource::open
void open()
Definition MyGUI_LogSource.cpp:23
MyGUI::LogSource::log
void log(std::string_view _section, LogLevel _level, const struct tm *_time, std::string_view _message, std::string_view _file, int _line)
Definition MyGUI_LogSource.cpp:41
MyGUI::LogSource::addLogListener
void addLogListener(ILogListener *_lestener)
Definition MyGUI_LogSource.cpp:18
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::LogLevel
Definition MyGUI_LogLevel.h:19