#pragma once #include #include "Ini.h" #include "Gui/FrameBase.h" class LogWriter { wxFile m_logfile; wxColour m_txtcolour; //wxString m_prefix; //wxString m_value; void WriteToLog(const std::string& prefix, const std::string& value, u8 lvl); public: LogWriter(); template void Write(const std::string &fmt, Arg&&... args) { std::string frmt = fmt::Format(fmt, std::forward(args)...); WriteToLog("!", frmt, 2); } template void Error(const std::string &fmt, Arg&&... args) { std::string frmt = fmt::Format(fmt, std::forward(args)...); WriteToLog("E", frmt, 4); } template void Warning(const std::string &fmt, Arg&&... args) { std::string frmt = fmt::Format(fmt, std::forward(args)...); WriteToLog("W", frmt, 3); } template void Success(const std::string &fmt, Arg&&... args) { std::string frmt = fmt::Format(fmt, std::forward(args)...); WriteToLog("S", frmt, 1); } virtual void SkipLn(); }; class LogFrame : public wxPanel , public ThreadBase { wxListView& m_log; public: LogFrame(wxWindow* parent); ~LogFrame(); bool Close(bool force = false); private: virtual void Task(); void OnQuit(wxCloseEvent& event); DECLARE_EVENT_TABLE(); }; extern LogWriter ConLog; extern LogFrame* ConLogFrame;