MyGUI 3.4.3
MyGUI_LogSource.cpp
Go to the documentation of this file.
1/*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7#include "MyGUI_Precompiled.h"
8#include "MyGUI_LogSource.h"
9
10namespace MyGUI
11{
12
14 {
15 mFilter = _filter;
16 }
17
19 {
20 mListeners.push_back(_lestener);
21 }
22
24 {
25 for (auto& listener : mListeners)
26 listener->open();
27 }
28
30 {
31 for (auto& listener : mListeners)
32 listener->close();
33 }
34
36 {
37 for (auto& listener : mListeners)
38 listener->flush();
39 }
40
42 std::string_view _section,
43 LogLevel _level,
44 const struct tm* _time,
45 std::string_view _message,
46 std::string_view _file,
47 int _line)
48 {
49 if (mFilter != nullptr)
50 {
51 if (!mFilter->shouldLog(_section, _level, _time, _message, _file, _line))
52 return;
53 }
54
55 for (auto& listener : mListeners)
56 listener->log(_section, _level, _time, _message, _file, _line);
57 }
58
59} // namespace MyGUI
void setLogFilter(ILogFilter *_filter)
void log(std::string_view _section, LogLevel _level, const struct tm *_time, std::string_view _message, std::string_view _file, int _line)
void addLogListener(ILogListener *_lestener)