userver
C++ Async Framework
Loading...
Searching...
No Matches
stacktrace_cache.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/logging/stacktrace_cache.hpp
4
/// @brief Cached stringification for Boost stack traces.
5
/// @ingroup userver_universal
6
7
#
include
<
string
>
8
9
#
include
<
boost
/
stacktrace
/
stacktrace_fwd
.
hpp
>
10
11
USERVER_NAMESPACE_BEGIN
12
13
/// @brief Cached stringification for stack traces.
14
namespace
logging::
stacktrace_cache
{
15
16
/// Get cached stacktrace
17
/// @see GlobalEnableStacktrace
18
std::string
to_string
(
const
boost::stacktrace::stacktrace& st);
// NOLINT(readability-identifier-naming)
19
20
/// Enable/disable stacktraces. If disabled, stacktrace_cache::to_string()
21
/// returns with a const string.
22
///
23
/// @note Disabling stacktraces is a hack for the Boost.Stacktrace memory leak
24
bool
GlobalEnableStacktrace
(
bool
enable);
25
26
/// RAII-wrapper for `GlobalEnableStacktrace`. Should be used to temporarily
27
/// enable stacktraces after `GlobalEnableStacktrace(false)`.
28
class
StacktraceGuard
{
29
public
:
30
explicit
StacktraceGuard(
bool
enabled);
31
32
~StacktraceGuard();
33
34
private
:
35
const
bool
old_;
36
};
37
38
}
// namespace logging::stacktrace_cache
39
40
USERVER_NAMESPACE_END
userver
logging
stacktrace_cache.hpp
Generated on Thu May 21 2026 16:22:46 for userver by
Doxygen
1.13.2