added color picking with ALT key, added crash report library for windows

This commit is contained in:
2017-05-29 08:47:04 +01:00
parent 6d14ccd426
commit 0f721393bb
19 changed files with 170 additions and 26 deletions

View File

@@ -17,6 +17,7 @@ void LogRemote::start()
m_running = true;
m_thread = std::thread([&] {
BT_SetTerminate();
net_init();
auto session_string = net_request("/start");
m_session = atoi(session_string.c_str());
@@ -65,6 +66,16 @@ void LogRemote::net_close()
curl = nullptr;
m_running = false;
}
void LogRemote::file_init()
{
if (!m_logfile.is_open())
m_logfile.open("log.txt");
}
void LogRemote::file_close()
{
if (!m_logfile.is_open())
m_logfile.close();
}
void LogRemote::log(const char* format, ...)
{
static char buffer[4096];
@@ -73,6 +84,12 @@ void LogRemote::log(const char* format, ...)
int n = vsnprintf(buffer, sizeof(buffer), format, arglist);
va_end(arglist);
m_mq.Post(std::string(buffer, n));
if (m_logfile.is_open())
{
auto line = std::string(buffer, n) + "\n";
m_logfile.write(line.data(), line.size());
m_logfile.flush();
}
}
void LogRemote::log(const wchar_t* format, ...)
{
@@ -98,6 +115,12 @@ void LogRemote::log(const wchar_t* format, ...)
//std::string converted_str = converter.to_bytes(string_to_convert);
m_mq.Post(std::move(converted));
if (m_logfile.is_open())
{
auto line = converted + "\n";
m_logfile.write(line.data(), line.size());
m_logfile.flush();
}
}
LogRemote::~LogRemote()
{