1
0
mirror of https://github.com/gabime/spdlog.git synced 2025-04-28 19:43:52 +00:00

Compare commits

..

No commits in common. "653ec05c0e82eed9c758ee28ecf40128da92a221" and "408a2229d69010155e6704866ebd8dad1c5dd794" have entirely different histories.

8 changed files with 23 additions and 27 deletions

View File

@ -143,7 +143,7 @@ void async_example()
#include "spdlog/fmt/bin_to_hex.h"
void binary_example()
{
std::vector<char> buf(80);
std::vector<char> buf;
for (int i = 0; i < 80; i++)
{
buf.push_back(static_cast<char>(i & 0xff));

View File

@ -26,7 +26,7 @@ SPDLOG_INLINE backtracer &backtracer::operator=(backtracer other)
{
std::lock_guard<std::mutex> lock(mutex_);
enabled_ = other.enabled();
messages_ = std::move(other.messages_);
messages_ = other.messages_;
return *this;
}

View File

@ -26,8 +26,8 @@ SPDLOG_INLINE log_msg_buffer::log_msg_buffer(const log_msg_buffer &other)
update_string_views();
}
SPDLOG_INLINE log_msg_buffer::log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT
: log_msg{other}
SPDLOG_INLINE log_msg_buffer::log_msg_buffer(log_msg_buffer &&other)
: log_msg{std::move(other)}
, buffer{std::move(other.buffer)}
{
update_string_views();
@ -42,9 +42,9 @@ SPDLOG_INLINE log_msg_buffer &log_msg_buffer::operator=(const log_msg_buffer &ot
return *this;
}
SPDLOG_INLINE log_msg_buffer &log_msg_buffer::operator=(log_msg_buffer &&other) SPDLOG_NOEXCEPT
SPDLOG_INLINE log_msg_buffer &log_msg_buffer::operator=(log_msg_buffer &&other)
{
log_msg::operator=(other);
log_msg::operator=(std::move(other));
buffer = std::move(other.buffer);
update_string_views();
return *this;

View File

@ -20,9 +20,9 @@ public:
log_msg_buffer() = default;
explicit log_msg_buffer(const log_msg &orig_msg);
log_msg_buffer(const log_msg_buffer &other);
log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT;
log_msg_buffer(log_msg_buffer &&other);
log_msg_buffer &operator=(const log_msg_buffer &other);
log_msg_buffer &operator=(log_msg_buffer &&other) SPDLOG_NOEXCEPT;
log_msg_buffer &operator=(log_msg_buffer &&other);
};
} // namespace details

View File

@ -277,7 +277,7 @@ SPDLOG_INLINE int utc_minutes_offset(const std::tm &tm)
return offset;
#else
#if defined(sun) || defined(__sun) || defined(_AIX) || (!defined(_BSD_SOURCE) && !defined(_GNU_SOURCE))
#if defined(sun) || defined(__sun) || defined(_AIX)
// 'tm_gmtoff' field is BSD extension and it's missing on SunOS/Solaris
struct helper
{
@ -428,7 +428,7 @@ SPDLOG_INLINE bool in_terminal(FILE *file) SPDLOG_NOEXCEPT
#if (defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) || defined(SPDLOG_WCHAR_FILENAMES)) && defined(_WIN32)
SPDLOG_INLINE void wstr_to_utf8buf(wstring_view_t wstr, memory_buf_t &target)
{
if (wstr.size() > static_cast<size_t>((std::numeric_limits<int>::max())))
if (wstr.size() > static_cast<size_t>(std::numeric_limits<int>::max()))
{
SPDLOG_THROW(spdlog::spdlog_ex("UTF-16 string is too big to be converted to UTF-8"));
}

View File

@ -593,7 +593,14 @@ public:
const size_t field_size = 6;
ScopedPadder p(field_size, padinfo_, dest);
auto total_minutes = get_cached_offset(msg, tm_time);
#ifdef _WIN32
int total_minutes = get_cached_offset(msg, tm_time);
#else
// No need to cache under gcc,
// it is very fast (already stored in tm.tm_gmtoff)
(void)(msg);
int total_minutes = os::utc_minutes_offset(tm_time);
#endif
bool is_negative = total_minutes < 0;
if (is_negative)
{
@ -612,6 +619,7 @@ public:
private:
log_clock::time_point last_update_{std::chrono::seconds(0)};
#ifdef _WIN32
int offset_minutes_{0};
int get_cached_offset(const log_msg &msg, const std::tm &tm_time)
@ -624,6 +632,7 @@ private:
}
return offset_minutes_;
}
#endif
};
// Thread id
@ -876,7 +885,7 @@ public:
fmt_helper::pad6(static_cast<size_t>(delta_units.count()), dest);
}
private:
protected:
log_clock::time_point last_message_time_;
};

View File

@ -150,7 +150,7 @@ SPDLOG_INLINE std::vector<sink_ptr> &logger::sinks()
// error handler
SPDLOG_INLINE void logger::set_error_handler(err_handler handler)
{
custom_err_handler_ = std::move(handler);
custom_err_handler_ = handler;
}
// create new logger with same sinks and configuration.

View File

@ -1,17 +1,4 @@
Checks: '\
cppcoreguidelines-*,\
performance-*,\
-performance-unnecessary-value-param,\
modernize-*,\
-modernize-use-trailing-return-type,\
google-*,\
-google-runtime-references,\
misc-*,\
-misc-non-private-member-variables-in-classes,\
cert-*,\
readability-*,\
clang-analyzer-*'
Checks: 'modernize-*,modernize-use-override,google-*,-google-runtime-references,misc-*,clang-analyzer-*,-misc-non-private-member-variables-in-classes, -modernize-use-trailing-return-type'
WarningsAsErrors: ''
HeaderFilterRegex: 'async.h|async_logger.h|common.h|details|formatter.h|logger.h|sinks|spdlog.h|tweakme.h|version.h'
AnalyzeTemporaryDtors: false