about summary refs log tree commit diff stats
path: root/src/main.cpp
blob: 5b036ea381b03e6791755f1b31d638cecd58e7fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <wx/wxprec.h>

#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif

#include <fstream>

#include "global.h"
#include "tracker_config.h"
#include "tracker_frame.h"

static std::ofstream* logfile;

class TrackerApp : public wxApp {
 public:
  virtual bool OnInit() {
    logfile = new std::ofstream(GetAbsolutePath("debug.log"));
    wxLog::SetActiveTarget(new wxLogStream(logfile));

#ifndef NDEBUG
    wxLog::SetVerbose(true);
    wxLog::SetActiveTarget(new wxLogWindow(nullptr, "Debug Log"));
#endif

    GetTrackerConfig().Load();

    TrackerFrame *frame = new TrackerFrame();
    frame->Show(true);
    return true;
  }
};

wxIMPLEMENT_APP(TrackerApp);