lsst.utils  13.0-9-gf29e843
 All Classes Namespaces Files Functions Variables Groups Pages
backtrace.cc
Go to the documentation of this file.
1 #include "pybind11/pybind11.h"
2 
3 #include "lsst/utils/Backtrace.h"
4 
5 namespace py = pybind11;
6 
7 namespace lsst {
8 namespace utils {
9 
10 PYBIND11_PLUGIN(backtrace) {
11  py::module mod("backtrace");
12 
13  Backtrace &backtrace = Backtrace::get();
14 
15  // Trick to tell the compiler backtrace is used and should not be
16  // optimized away, as well as convenient way to check if backtrace
17  // is enabled.
18  mod.def("isEnabled", [&backtrace]() -> bool { return backtrace.isEnabled(); });
19 
20  return mod.ptr();
21 }
22 
23 } // utils
24 } // lsst
PYBIND11_PLUGIN(backtrace)
Definition: backtrace.cc:10
Singleton, enables automatic backtraces on the following signals:
Definition: Backtrace.h:42
bool const isEnabled() const noexcept
Definition: Backtrace.h:56
static Backtrace & get() noexcept
Get a reference to the singleton.
Definition: Backtrace.h:51