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