MyGUI_FileLogListener.h
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)
*/
#ifndef MYGUI_FILE_LOG_LISTENER_H_
#define MYGUI_FILE_LOG_LISTENER_H_
#include "MyGUI_Prerequest.h"
#include "MyGUI_ILogListener.h"
#include <fstream>
#include <string>
namespace MyGUI
{
class MYGUI_EXPORT FileLogListener : public ILogListener
{
public:
void open() override;
void close() override;
void flush() override;
void log(
std::string_view _section,
LogLevel _level,
const struct tm* _time,
std::string_view _message,
std::string_view _file,
int _line) override;
void setFileName(std::string_view _value);
const std::string& getFileName() const;
private:
std::ofstream mStream;
std::string mFileName;
};
} // namespace MyGUI
#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