diff --git a/include/spdlog/details/pattern_formatter.h b/include/spdlog/details/pattern_formatter.h index a35564be..afa75f16 100644 --- a/include/spdlog/details/pattern_formatter.h +++ b/include/spdlog/details/pattern_formatter.h @@ -498,8 +498,13 @@ class full_formatter final : public flag_formatter } fmt_helper::append_buf(cached_datetime_, dest); +#ifdef SPDLOG_HIGH_RES + auto micros = fmt_helper::time_fraction(msg.time); + fmt_helper::pad6(static_cast(micros.count()), dest); +#else auto millis = fmt_helper::time_fraction(msg.time); fmt_helper::pad3(static_cast(millis.count()), dest); +#endif dest.push_back(']'); dest.push_back(' '); diff --git a/include/spdlog/tweakme.h b/include/spdlog/tweakme.h index 2c260ec5..caa88814 100644 --- a/include/spdlog/tweakme.h +++ b/include/spdlog/tweakme.h @@ -61,6 +61,13 @@ // #define SPDLOG_NO_NAME /////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +// Uncomment to make default pattern replace milliseconds with microseconds on +// tail. +// +// #define SPDLOG_HIGH_RES +/////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////// // Uncomment to enable the SPDLOG_DEBUG/SPDLOG_TRACE macros. //