Fixed dependency for glibc or smth ig
This commit is contained in:
parent
bbf7950bfa
commit
4874a49aaa
@ -110,6 +110,9 @@ class Logger {
|
||||
// Helper functions
|
||||
static std::string_view moduleToString(LogModule m);
|
||||
static std::string_view levelToString(LogLevel l);
|
||||
inline std::string formatTimestamp(
|
||||
std::chrono::system_clock::time_point tp
|
||||
);
|
||||
};
|
||||
|
||||
#endif // End of header
|
||||
@ -140,8 +143,7 @@ void Logger::logRAM(
|
||||
Args&&... args
|
||||
) {
|
||||
auto now { std::chrono::system_clock::now() };
|
||||
now = std::chrono::zoned_time{ std::chrono::current_zone(), now };
|
||||
auto timestamp = std::format("{:%Y-%m-%d %H:%M}", now);
|
||||
auto timestamp = formatTimestamp(now);
|
||||
auto start = logBuffer.size();
|
||||
|
||||
fmt::format_to(
|
||||
@ -177,7 +179,7 @@ void Logger::logConsole(
|
||||
) {
|
||||
std::string tempBuffer;
|
||||
auto now = std::chrono::system_clock::now();
|
||||
auto timestamp = std::format("{:%Y-%m-%d %H:%M}", now);
|
||||
auto timestamp = formatTimestamp(now);
|
||||
|
||||
fmt::format_to(
|
||||
std::back_inserter(tempBuffer),
|
||||
@ -219,7 +221,7 @@ void Logger::logDisk(
|
||||
// Create a temporary buffer
|
||||
std::string tempBuffer;
|
||||
auto now = std::chrono::system_clock::now();
|
||||
auto timestamp = std::format("{:%Y-%m-%d %H:%M}", now);
|
||||
auto timestamp = formatTimestamp(now);
|
||||
|
||||
fmt::format_to(
|
||||
std::back_inserter(tempBuffer),
|
||||
@ -379,5 +381,14 @@ std::string_view Logger::levelToString(LogLevel l) {
|
||||
}
|
||||
}
|
||||
|
||||
std::string Logger::formatTimestamp(
|
||||
std::chrono::system_clock::time_point tp
|
||||
) {
|
||||
std::time_t t = std::chrono::system_clock::to_time_t(tp);
|
||||
std::tm tm{};
|
||||
localtime_r(&t, &tm);
|
||||
return fmt::format("{:%Y-%m-%d %H:%M}", tm);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -12,6 +12,8 @@
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include <fmt/base.h>
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/chrono.h>
|
||||
#include <stdexcept>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user