#include #include #include #include using namespace std; string timeNow; void getSystemTime() { time_t now = time(0); tm ltm; localtime_s(<m, &now); string sec; if (ltm.tm_sec < 10) { sec = "0" + to_string(ltm.tm_sec); } timeNow = to_string(ltm.tm_year + 1900) + "-" + to_string(ltm.tm_mon + 1) + "-" + to_string(ltm.tm_mday) + " " + to_string(ltm.tm_hour) + ":" + to_string(ltm.tm_min) + ":" + to_string(ltm.tm_sec); } void postLog(int level, const string &message) { string levelStr; switch (level) { case 0: levelStr = "DEBUG"; break; case 1: levelStr = "INFO"; break; case 2: levelStr = "WARNING"; break; case 3: levelStr = "ERROR"; break; default: levelStr = "UNKNOWN"; } cout << "[" << timeNow << " - " << levelStr << "] " << message << endl; }