rename engine to src
This commit is contained in:
38
src/log.h
Normal file
38
src/log.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#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;
|
||||
std::ofstream m_logfile;
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
void net_init();
|
||||
std::string net_request(std::string cmd, std::string data = "");
|
||||
void net_close();
|
||||
void file_init();
|
||||
void file_close();
|
||||
void log(const char* format, ...);
|
||||
void log(const wchar_t* format, ...);
|
||||
~LogRemote();
|
||||
};
|
||||
Reference in New Issue
Block a user