MyGUI  3.2.1
MyGUI_FileLogListener.h
Go to the documentation of this file.
00001 /*
00002  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
00003  * Distributed under the MIT License
00004  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
00005  */
00006 
00007 #ifndef __MYGUI_FILE_LOG_LISTENER_H__
00008 #define __MYGUI_FILE_LOG_LISTENER_H__
00009 
00010 #include "MyGUI_Prerequest.h"
00011 #include "MyGUI_ILogListener.h"
00012 #include <fstream>
00013 #include <string>
00014 
00015 namespace MyGUI
00016 {
00017 
00018     class MYGUI_EXPORT FileLogListener :
00019         public ILogListener
00020     {
00021     public:
00022         FileLogListener();
00023         virtual ~FileLogListener();
00024 
00026         virtual void open();
00028         virtual void close();
00030         virtual void flush();
00032         virtual void log(const std::string& _section, LogLevel _level, const struct tm* _time, const std::string& _message, const char* _file, int _line);
00033 
00035         void setFileName(const std::string& _value);
00037         const std::string& getFileName() const;
00038 
00039     private:
00040         std::ofstream mStream;
00041         std::string mFileName;
00042     };
00043 
00044 } // namespace MyGUI
00045 
00046 #endif // __MYGUI_FILE_LOG_LISTENER_H__