File indexing completed on 2025-01-30 10:24:43
0001
0002
0003
0004 #pragma once
0005
0006 #ifndef SPDLOG_HEADER_ONLY
0007 # include <spdlog/details/log_msg_buffer.h>
0008 #endif
0009
0010 namespace spdlog {
0011 namespace details {
0012
0013 SPDLOG_INLINE log_msg_buffer::log_msg_buffer(const log_msg &orig_msg)
0014 : log_msg{orig_msg}
0015 {
0016 buffer.append(logger_name.begin(), logger_name.end());
0017 buffer.append(payload.begin(), payload.end());
0018 update_string_views();
0019 }
0020
0021 SPDLOG_INLINE log_msg_buffer::log_msg_buffer(const log_msg_buffer &other)
0022 : log_msg{other}
0023 {
0024 buffer.append(logger_name.begin(), logger_name.end());
0025 buffer.append(payload.begin(), payload.end());
0026 update_string_views();
0027 }
0028
0029 SPDLOG_INLINE log_msg_buffer::log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT : log_msg{other}, buffer{std::move(other.buffer)}
0030 {
0031 update_string_views();
0032 }
0033
0034 SPDLOG_INLINE log_msg_buffer &log_msg_buffer::operator=(const log_msg_buffer &other)
0035 {
0036 log_msg::operator=(other);
0037 buffer.clear();
0038 buffer.append(other.buffer.data(), other.buffer.data() + other.buffer.size());
0039 update_string_views();
0040 return *this;
0041 }
0042
0043 SPDLOG_INLINE log_msg_buffer &log_msg_buffer::operator=(log_msg_buffer &&other) SPDLOG_NOEXCEPT
0044 {
0045 log_msg::operator=(other);
0046 buffer = std::move(other.buffer);
0047 update_string_views();
0048 return *this;
0049 }
0050
0051 SPDLOG_INLINE void log_msg_buffer::update_string_views()
0052 {
0053 logger_name = string_view_t{buffer.data(), logger_name.size()};
0054 payload = string_view_t{buffer.data() + logger_name.size(), payload.size()};
0055 }
0056
0057 }
0058 }