diff options
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
| diff --git a/src/main.cpp b/src/main.cpp index 5b036ea..574b6df 100644 --- a/src/main.cpp +++ b/src/main.cpp | |||
| @@ -4,31 +4,29 @@ | |||
| 4 | #include <wx/wx.h> | 4 | #include <wx/wx.h> |
| 5 | #endif | 5 | #endif |
| 6 | 6 | ||
| 7 | #include <fstream> | ||
| 8 | |||
| 9 | #include "global.h" | 7 | #include "global.h" |
| 10 | #include "tracker_config.h" | 8 | #include "tracker_config.h" |
| 11 | #include "tracker_frame.h" | 9 | #include "tracker_frame.h" |
| 12 | 10 | ||
| 13 | static std::ofstream* logfile; | ||
| 14 | |||
| 15 | class TrackerApp : public wxApp { | 11 | class TrackerApp : public wxApp { |
| 16 | public: | 12 | public: |
| 17 | virtual bool OnInit() { | 13 | virtual bool OnInit() override { |
| 18 | logfile = new std::ofstream(GetAbsolutePath("debug.log")); | ||
| 19 | wxLog::SetActiveTarget(new wxLogStream(logfile)); | ||
| 20 | |||
| 21 | #ifndef NDEBUG | ||
| 22 | wxLog::SetVerbose(true); | ||
| 23 | wxLog::SetActiveTarget(new wxLogWindow(nullptr, "Debug Log")); | ||
| 24 | #endif | ||
| 25 | |||
| 26 | GetTrackerConfig().Load(); | 14 | GetTrackerConfig().Load(); |
| 27 | 15 | ||
| 28 | TrackerFrame *frame = new TrackerFrame(); | 16 | TrackerFrame *frame = new TrackerFrame(); |
| 29 | frame->Show(true); | 17 | frame->Show(true); |
| 30 | return true; | 18 | return true; |
| 31 | } | 19 | } |
| 20 | |||
| 21 | bool OnExceptionInMainLoop() override { | ||
| 22 | try { | ||
| 23 | throw; | ||
| 24 | } catch (const std::exception& ex) { | ||
| 25 | wxLogError(ex.what()); | ||
| 26 | } | ||
| 27 | |||
| 28 | return false; | ||
| 29 | } | ||
| 32 | }; | 30 | }; |
| 33 | 31 | ||
| 34 | wxIMPLEMENT_APP(TrackerApp); | 32 | wxIMPLEMENT_APP(TrackerApp); |
