Photon 1.0.0
Loading...
Searching...
No Matches
backtracer.h
Go to the documentation of this file.
1// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2// Distributed under the MIT License (http://opensource.org/licenses/MIT)
3
4#pragma once
5
8
9#include <atomic>
10#include <mutex>
11#include <functional>
12
13// Store log messages in circular buffer.
14// Useful for storing debug data in case of error/warning happens.
15
16namespace spdlog
17{
18 namespace details
19 {
21 {
22 mutable std::mutex mutex_;
23 std::atomic<bool> enabled_{false};
25
26 public:
27 backtracer() = default;
28 backtracer(const backtracer& other);
29
31 backtracer& operator=(backtracer other);
32
33 void enable(size_t size);
34 void disable();
35 bool enabled() const;
36 void push_back(const log_msg& msg);
37 bool empty() const;
38
39 // pop all items in the q and apply the given fun on each of them.
40 void foreach_pop(std::function<void(const details::log_msg&)> fun);
41 };
42
43 } // namespace details
44} // namespace spdlog
45
46#ifdef SPDLOG_HEADER_ONLY
47#include "backtracer-inl.h"
48#endif
Definition backtracer.h:21
std::mutex mutex_
Definition backtracer.h:22
circular_q< log_msg_buffer > messages_
Definition backtracer.h:24
Definition circular_q.h:16
#define SPDLOG_NOEXCEPT
Definition common.h:69
#define SPDLOG_API
Definition common.h:45
Definition async.h:26
Definition log_msg.h:14
annotation details
Definition tag_strings.h:125