#include #include #include #include #include #include #include #include UxLogger uxlogger; static std::mutex mtx; UxLogger::UxLogger(const std::string ilabel) { label = ilabel; } UxLogger::UxLogger(void) { label = "global"; } void UxLogger::Log(const std::string& message) { auto now = std::chrono::system_clock::now(); std::chrono::zoned_time localnow{std::chrono::current_zone(), now}; std::string timenow = std::format("{:%Y-%m-%dT%H:%M:%OS%Z}", localnow); std::lock_guard lock(mtx); std::cout << std::format("{} {} {}\n", timenow, label, message); } void UxLogger::Debug(const std::string& message) { LogLevel("debug", message); } void UxLogger::Info(const std::string& message) { LogLevel("info", message); } void UxLogger::Warning(const std::string& message) { LogLevel("warning", message); } void UxLogger::Error(const std::string& message) { LogLevel("error", message); } void UxLogger::LogLevel(const std::string level, const std::string& message) { auto now = std::chrono::system_clock::now(); std::chrono::zoned_time localnow{std::chrono::current_zone(), now}; std::string timenow = std::format("{:%Y-%m-%dT%H:%M:%OS%Z}", localnow); std::lock_guard lock(mtx); std::cout << std::format("{} {} {} {}\n", timenow, level, label, message); }