2019-08-22 19:36:47 +03:00
|
|
|
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
|
|
|
|
|
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2019-11-06 19:09:30 +00:00
|
|
|
#include <spdlog/details/log_msg.h>
|
2019-08-22 19:36:47 +03:00
|
|
|
|
|
|
|
|
namespace spdlog {
|
|
|
|
|
namespace details {
|
|
|
|
|
|
2019-09-19 12:02:59 +03:00
|
|
|
// Extend log_msg with internal buffer to store its payload.
|
2020-05-01 08:54:16 +07:00
|
|
|
// This is needed since log_msg holds string_views that points to stack data.
|
2019-08-23 00:16:13 +03:00
|
|
|
|
2020-03-10 02:02:16 +07:00
|
|
|
class SPDLOG_API log_msg_buffer : public log_msg
|
2019-08-22 19:36:47 +03:00
|
|
|
{
|
2019-08-28 18:46:09 +03:00
|
|
|
memory_buf_t buffer;
|
2019-09-21 18:16:38 +03:00
|
|
|
void update_string_views();
|
|
|
|
|
|
2019-08-23 01:10:48 +03:00
|
|
|
public:
|
2019-08-22 19:36:47 +03:00
|
|
|
log_msg_buffer() = default;
|
2019-09-21 18:16:38 +03:00
|
|
|
explicit log_msg_buffer(const log_msg &orig_msg);
|
|
|
|
|
log_msg_buffer(const log_msg_buffer &other);
|
2019-11-08 15:21:18 +02:00
|
|
|
log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT;
|
2019-09-21 18:16:38 +03:00
|
|
|
log_msg_buffer &operator=(const log_msg_buffer &other);
|
2019-11-08 16:20:41 +02:00
|
|
|
log_msg_buffer &operator=(log_msg_buffer &&other) SPDLOG_NOEXCEPT;
|
2019-08-22 19:36:47 +03:00
|
|
|
};
|
|
|
|
|
|
2019-08-22 19:38:00 +03:00
|
|
|
} // namespace details
|
2019-08-31 21:30:36 +02:00
|
|
|
} // namespace spdlog
|
2019-09-19 11:52:03 +03:00
|
|
|
|
|
|
|
|
#ifdef SPDLOG_HEADER_ONLY
|
2021-07-19 00:50:51 +03:00
|
|
|
# include "log_msg_buffer-inl.h"
|
2019-09-19 11:52:03 +03:00
|
|
|
#endif
|