MyGUI: MyGUI_FileLogListener.h Source File

MyGUI 3.4.3

MyGUI_FileLogListener.h
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#ifndef MYGUI_FILE_LOG_LISTENER_H_
8#define MYGUI_FILE_LOG_LISTENER_H_
9
10#include "MyGUI_Prerequest.h"
11#include "MyGUI_ILogListener.h"
12#include <fstream>
13#include <string>
14
15namespace MyGUI
16{
17
18 class MYGUI_EXPORT FileLogListener : public ILogListener
19 {
20 public:
22 void open() override;
24 void close() override;
26 void flush() override;
28 void log(
29 std::string_view _section,
30 LogLevel _level,
31 const struct tm* _time,
32 std::string_view _message,
33 std::string_view _file,
34 int _line) override;
35
37 void setFileName(std::string_view _value);
39 const std::string& getFileName() const;
40
41 private:
42 std::ofstream mStream;
43 std::string mFileName;
44 };
45
46} // namespace MyGUI
47
48#endif // MYGUI_FILE_LOG_LISTENER_H_
MyGUI_ILogListener.h
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI_Prerequest.h
MyGUI::FileLogListener
Definition MyGUI_FileLogListener.h:19
MyGUI::FileLogListener::setFileName
void setFileName(std::string_view _value)
Definition MyGUI_FileLogListener.cpp:67
MyGUI::FileLogListener::flush
void flush() override
Definition MyGUI_FileLogListener.cpp:43
MyGUI::FileLogListener::log
void log(std::string_view _section, LogLevel _level, const struct tm *_time, std::string_view _message, std::string_view _file, int _line) override
Definition MyGUI_FileLogListener.cpp:49
MyGUI::FileLogListener::open
void open() override
Definition MyGUI_FileLogListener.cpp:15
MyGUI::FileLogListener::close
void close() override
Definition MyGUI_FileLogListener.cpp:37
MyGUI::FileLogListener::getFileName
const std::string & getFileName() const
Definition MyGUI_FileLogListener.cpp:72
MyGUI::ILogListener
Definition MyGUI_ILogListener.h:17
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::LogLevel
Definition MyGUI_LogLevel.h:19