You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 line
886B

  1. // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
  2. // Distributed under the MIT License (http://opensource.org/licenses/MIT)
  3. #pragma once
  4. #include "spdlog/details/log_msg.h"
  5. namespace spdlog {
  6. namespace details {
  7. // Extend log_msg with internal buffer to store its payload.
  8. // THis is needed since log_msg holds string_views that points to stack data.
  9. class log_msg_buffer : public log_msg
  10. {
  11. memory_buf_t buffer;
  12. void update_string_views();
  13. public:
  14. log_msg_buffer() = default;
  15. explicit log_msg_buffer(const log_msg &orig_msg);
  16. log_msg_buffer(const log_msg_buffer &other);
  17. log_msg_buffer(log_msg_buffer &&other);
  18. log_msg_buffer &operator=(const log_msg_buffer &other);
  19. log_msg_buffer &operator=(log_msg_buffer &&other);
  20. };
  21. } // namespace details
  22. } // namespace spdlog
  23. #ifdef SPDLOG_HEADER_ONLY
  24. #include "log_msg_buffer-inl.h"
  25. #endif