#pragma once // third party library #include "fmt/format.h" #include "spdlog/pattern_formatter.h" // mitech library #include "utility.h" class CTimingFormatterFlag : public spdlog::custom_flag_formatter { public: void format(const spdlog::details::log_msg&, const std::tm&, spdlog::memory_buf_t& dest) override { auto myTime = m_HighResCounter.GetCurrentTimeSpanInMsec(); std::string strTime = fmt::format("{:d}.{:03d}", (myTime / 1000), (myTime % 1000)); dest.append(strTime.data(), strTime.data() + strTime.size()); } std::unique_ptr clone() const override { return spdlog::details::make_unique(); } private: CHighResPerformanceCounter m_HighResCounter; };