- implemented frontend
- namespaced Core
- imported qdevicewatcher
- fixed bug in logging (more like in misc)
This commit is contained in:
zhupengfei
2019-08-28 19:16:05 +08:00
parent fd5106759a
commit 7df0b63a1e
22 changed files with 351 additions and 166 deletions
+9 -3
View File
@@ -14,6 +14,8 @@
#include <fmt/format.h>
#include "common/string_util.h"
#include <iostream>
template <typename... Args>
void PrintLog(std::FILE* f, const std::string& log_class, const std::string& level,
const std::string& color, const std::string& file, int line, const std::string& func,
@@ -23,9 +25,13 @@ void PrintLog(std::FILE* f, const std::string& log_class, const std::string& lev
std::chrono::steady_clock::now() - time_origin)
.count();
const auto real_class = Common::ReplaceAll(log_class, "_", ".");
fmt::print(f, "\x1b{}[{:12.6f}] {} <{}> {}:{}:{}: " + format + "\x1b[0m\n", color,
us / 1000000.0, log_class, level, file, line, func, args...);
fflush(stderr);
try {
fmt::print(f, "\x1b{}[{:12.6f}] {} <{}> {}:{}:{}: " + format + "\x1b[0m\n", color,
us / 1000000.0, real_class, level, file, line, func, args...);
fflush(stderr);
} catch (...) {
std::cerr << "FMT failed with exception" << std::endl;
}
}
#ifdef _DEBUG
+2 -2
View File
@@ -3,11 +3,11 @@
// Refer to the license.txt file included.
#include <cstddef>
#include <cstring>
#ifdef _WIN32
#include <windows.h>
#else
#include <cerrno>
#include <cstring>
#endif
#include "common/common_funcs.h"
@@ -27,5 +27,5 @@ std::string GetLastErrorMsg() {
strerror_r(errno, err_str, buff_size);
#endif
return std::string(err_str, buff_size);
return std::string(err_str, strnlen(err_str, buff_size));
}