]> git.hungrycats.org Git - bees/commitdiff
trace: move BeesTrace::set_silent to lib
authorZygo Blaxell <bees@furryterror.org>
Mon, 8 Jun 2026 04:06:16 +0000 (00:06 -0400)
committerZygo Blaxell <bees@furryterror.org>
Sun, 30 Aug 2026 23:48:46 +0000 (19:48 -0400)
Make it easier to link components that use BeesTrace into test binaries.

Assisted-by: Claude-Code:claude-opus-4-7
Signed-off-by: Zygo Blaxell <bees@furryterror.org>
src/bees-lib.h
src/bees-trace.cc

index e638146db74c0d9200250c42a8b1c668a56588f3..a27e48891dc64269f5e8ef3a7996944d85ebdcc1 100644 (file)
@@ -22,6 +22,11 @@ std::string format_time(time_t t);
 /// stack unwinding), NOT exceptions that are currently being handled inside a catch block.
 bool exception_check();
 
+/// Suppress BeesTracer output for the current unwind.
+/// Lightweight wrapper for BeesTracer::set_silent() that can be
+/// called without including the full BeesTracer class definition.
+void bees_tracer_set_silent();
+
 /// open(2) with bees flag conventions; returns the raw fd or throws.
 /// @p flags is @c uint64_t because @c openat2() (the preferred call) uses
 /// @c uint64_t in @c open_how.  Falls back to @c openat() when @c openat2()
index 08361d29f02f95529cd72089fadd0e7f8de7e80f..3c7a85a418a76dfd127206e9e18320ff05b4db4a 100644 (file)
@@ -10,6 +10,12 @@ thread_local BeesTracer *BeesTracer::tl_next_tracer = nullptr;
 thread_local bool BeesTracer::tl_first = true;
 thread_local bool BeesTracer::tl_silent = false;
 
+void
+bees_tracer_set_silent()
+{
+       BeesTracer::set_silent();
+}
+
 BeesTracer::~BeesTracer()
 {
        if (!tl_silent && exception_check()) {