working commit
This commit is contained in:
@@ -22,6 +22,7 @@ UxLogger::UxLogger(const std::string 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};
|
||||
@@ -30,3 +31,27 @@ void UxLogger::Log(const std::string& message) {
|
||||
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<std::mutex> lock(mtx);
|
||||
std::cout << std::format("{} {} {} {}\n", timenow, level, label, message);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user