Files
panopainter/engine/log.h

35 lines
1.0 KiB
C++

#pragma once
#include "util.h"
#ifdef __APPLE__
#define LOG(M,...) { printf(M"\n", ##__VA_ARGS__); LogRemote::I.log(M, ##__VA_ARGS__); }
#elif __ANDROID__
#define LOG(...) { ((void)__android_log_print(ANDROID_LOG_INFO, "native-engine", __VA_ARGS__)); LogRemote::I.log(__VA_ARGS__); }
#elif _WIN32
#define LOG(M,...) { printf(M"\n", ##__VA_ARGS__); LogRemote::I.log(M, ##__VA_ARGS__); }
#define LOGW(M,...) { wprintf(M"\n", ##__VA_ARGS__); LogRemote::I.log(M, ##__VA_ARGS__); }
#endif
class LogRemote
{
public:
static LogRemote I;
bool m_running = false;
bool m_error = false;
std::thread m_thread;
ui::BlockingQueue<std::string> m_mq;
CURL *curl = nullptr;
CURLcode res;
std::string readBuffer;
std::string m_url = "http://omigamedev.ddns.net:8083";
int m_session;
void start();
void net_init();
std::string net_request(std::string cmd, std::string data = "");
void net_close();
void log(const char* format, ...);
void log(const wchar_t* format, ...);
~LogRemote();
};