#include "TimestampLog.hpp" #include #include ugly::TimestampLog::TimestampLog(std::ostream &os, std::string_view description): mrOutputStream{os}, mDescription{description}, mStart{std::chrono::high_resolution_clock::now()} {} void ugly::TimestampLog::vlog(std::string_view fmt, std::format_args args) { auto now = std::chrono::high_resolution_clock::now(); auto timestamp = std::chrono::duration_cast>(now - mStart).count(); auto message = std::vformat(fmt, args); mrOutputStream << std::format("[{:9.4f}] {}: {}\n", timestamp, mDescription, message); }