mirror of
https://github.com/gabime/spdlog.git
synced 2025-10-02 11:29:01 +08:00
Removed SPDLOG_NO_DATETIME option
This commit is contained in:
@@ -15,10 +15,7 @@ namespace details {
|
||||
SPDLOG_INLINE log_msg::log_msg(spdlog::source_loc loc, string_view_t logger_name, spdlog::level::level_enum lvl, spdlog::string_view_t msg)
|
||||
: logger_name(logger_name)
|
||||
, level(lvl)
|
||||
#ifndef SPDLOG_NO_DATETIME
|
||||
, time(os::now())
|
||||
#endif
|
||||
|
||||
#ifndef SPDLOG_NO_THREAD_ID
|
||||
, thread_id(os::thread_id())
|
||||
#endif
|
||||
|
@@ -904,8 +904,6 @@ public:
|
||||
using std::chrono::milliseconds;
|
||||
using std::chrono::seconds;
|
||||
|
||||
#ifndef SPDLOG_NO_DATETIME
|
||||
|
||||
// cache the date/time part for the next second.
|
||||
auto duration = msg.time.time_since_epoch();
|
||||
auto secs = duration_cast<seconds>(duration);
|
||||
@@ -941,10 +939,6 @@ public:
|
||||
dest.push_back(']');
|
||||
dest.push_back(' ');
|
||||
|
||||
#else // no datetime needed
|
||||
(void)tm_time;
|
||||
#endif
|
||||
|
||||
#ifndef SPDLOG_NO_NAME
|
||||
if (msg.logger_name.size() > 0)
|
||||
{
|
||||
@@ -1014,14 +1008,13 @@ SPDLOG_INLINE std::unique_ptr<formatter> pattern_formatter::clone() const
|
||||
|
||||
SPDLOG_INLINE void pattern_formatter::format(const details::log_msg &msg, memory_buf_t &dest)
|
||||
{
|
||||
#ifndef SPDLOG_NO_DATETIME
|
||||
auto secs = std::chrono::duration_cast<std::chrono::seconds>(msg.time.time_since_epoch());
|
||||
if (secs != last_log_secs_)
|
||||
{
|
||||
cached_tm_ = get_time_(msg);
|
||||
last_log_secs_ = secs;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (auto &f : formatters_)
|
||||
{
|
||||
f->format(msg, cached_tm_, dest);
|
||||
|
Reference in New Issue
Block a user