working commit
This commit is contained in:
+2
-16
@@ -15,21 +15,7 @@ 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<std::mutex> lock(mtx);
|
||||
std::cout << std::format("{} {} {}\n", timenow, label, message);
|
||||
}
|
||||
UxLogger::UxLogger(void) {}
|
||||
|
||||
void UxLogger::Debug(const std::string& message) {
|
||||
LogLevel("debug", message);
|
||||
@@ -52,6 +38,6 @@ void UxLogger::LogLevel(const std::string level, const std::string& message) {
|
||||
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<std::mutex> lock(mtx);
|
||||
std::cout << std::format("{} {} {} {}\n", timenow, level, label, message);
|
||||
std::cout << std::format("{} [{}] {}\n", timenow, level, message);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user