mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-15 09:17:57 +00:00
Compare commits
11 Commits
408a2229d6
...
653ec05c0e
Author | SHA1 | Date | |
---|---|---|---|
|
653ec05c0e | ||
|
be2a751513 | ||
|
840adfbbcf | ||
|
3999613eca | ||
|
bff85725d2 | ||
|
93008b2369 | ||
|
be336e7514 | ||
|
255f7f2dee | ||
|
de2c07ac62 | ||
|
844d54d7e6 | ||
|
ff3e6c7248 |
@ -143,7 +143,7 @@ void async_example()
|
||||
#include "spdlog/fmt/bin_to_hex.h"
|
||||
void binary_example()
|
||||
{
|
||||
std::vector<char> buf;
|
||||
std::vector<char> buf(80);
|
||||
for (int i = 0; i < 80; i++)
|
||||
{
|
||||
buf.push_back(static_cast<char>(i & 0xff));
|
||||
|
@ -26,7 +26,7 @@ SPDLOG_INLINE backtracer &backtracer::operator=(backtracer other)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
enabled_ = other.enabled();
|
||||
messages_ = other.messages_;
|
||||
messages_ = std::move(other.messages_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
: log_msg{std::move(other)}
|
||||
SPDLOG_INLINE log_msg_buffer::log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT
|
||||
: log_msg{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_INLINE log_msg_buffer &log_msg_buffer::operator=(log_msg_buffer &&other) SPDLOG_NOEXCEPT
|
||||
{
|
||||
log_msg::operator=(std::move(other));
|
||||
log_msg::operator=(other);
|
||||
buffer = std::move(other.buffer);
|
||||
update_string_views();
|
||||
return *this;
|
||||
|
@ -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);
|
||||
log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT;
|
||||
log_msg_buffer &operator=(const log_msg_buffer &other);
|
||||
log_msg_buffer &operator=(log_msg_buffer &&other);
|
||||
log_msg_buffer &operator=(log_msg_buffer &&other) SPDLOG_NOEXCEPT;
|
||||
};
|
||||
|
||||
} // namespace details
|
||||
|
@ -277,7 +277,7 @@ SPDLOG_INLINE int utc_minutes_offset(const std::tm &tm)
|
||||
return offset;
|
||||
#else
|
||||
|
||||
#if defined(sun) || defined(__sun) || defined(_AIX)
|
||||
#if defined(sun) || defined(__sun) || defined(_AIX) || (!defined(_BSD_SOURCE) && !defined(_GNU_SOURCE))
|
||||
// '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"));
|
||||
}
|
||||
|
@ -593,14 +593,7 @@ public:
|
||||
const size_t field_size = 6;
|
||||
ScopedPadder p(field_size, padinfo_, dest);
|
||||
|
||||
#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
|
||||
auto total_minutes = get_cached_offset(msg, tm_time);
|
||||
bool is_negative = total_minutes < 0;
|
||||
if (is_negative)
|
||||
{
|
||||
@ -619,7 +612,6 @@ 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)
|
||||
@ -632,7 +624,6 @@ private:
|
||||
}
|
||||
return offset_minutes_;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
// Thread id
|
||||
@ -885,7 +876,7 @@ public:
|
||||
fmt_helper::pad6(static_cast<size_t>(delta_units.count()), dest);
|
||||
}
|
||||
|
||||
protected:
|
||||
private:
|
||||
log_clock::time_point last_message_time_;
|
||||
};
|
||||
|
||||
|
@ -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_ = handler;
|
||||
custom_err_handler_ = std::move(handler);
|
||||
}
|
||||
|
||||
// create new logger with same sinks and configuration.
|
||||
|
@ -1,4 +1,17 @@
|
||||
Checks: 'modernize-*,modernize-use-override,google-*,-google-runtime-references,misc-*,clang-analyzer-*,-misc-non-private-member-variables-in-classes, -modernize-use-trailing-return-type'
|
||||
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-*'
|
||||
|
||||
WarningsAsErrors: ''
|
||||
HeaderFilterRegex: 'async.h|async_logger.h|common.h|details|formatter.h|logger.h|sinks|spdlog.h|tweakme.h|version.h'
|
||||
AnalyzeTemporaryDtors: false
|
||||
|
Loading…
Reference in New Issue
Block a user