about summary refs log tree commit diff stats
path: root/src/logger.cpp
blob: dddcc4abe7c7ece025221e73682455a3f1102cbb (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
#include "logger.h"

#include "global.h"

Logger::Logger() : logfile_(GetAbsolutePath("debug.log")) {}

void Logger::Flush() {
  wxLog::Flush();

  std::lock_guard guard(file_mutex_);
  logfile_.flush();
}

Logger::~Logger() {
  std::lock_guard guard(file_mutex_);
  logfile_.flush();
}

void Logger::DoLogText(const wxString& msg) {
#ifdef _WIN64
  OutputDebugStringA(msg.c_str());
  OutputDebugStringA("\r\n");
#endif

  std::lock_guard guard(file_mutex_);
  logfile_ << msg << std::endl;
}