]> git.hungrycats.org Git - bees/commit
trace: Redesign BeesTracer to accumulate and conditionally log traces
authorZygo Blaxell <bees@furryterror.org>
Sat, 23 May 2026 21:47:55 +0000 (17:47 -0400)
committerZygo Blaxell <bees@furryterror.org>
Sat, 5 Sep 2026 04:03:57 +0000 (00:03 -0400)
commit0900d0a4d2fa5ef45a75ca7f939e593af7428ab2
tree70ccd94905936f2f7499e5eeb8c525425327c696
parent09eee6a7f3170d2aef5048fc75445504ecbd0c80
trace: Redesign BeesTracer to accumulate and conditionally log traces

Redesign the BeesTracer class and BEESTRACE macro to collect trace messages in
a thread-local accumulator (tl_captured_traces) during exception stack
unwinding rather than logging them immediately.

If stack unwinding successfully reaches the top of the stack (outermost
tracer), the accumulated traces are written in natural function call order
(caller-first) bracketed by standard BEGIN and END markers. If the exception
is caught early, the traces are safely discarded without polluting logs.

Additionally, update the BEESTRACE macro to use C++14 lambda init-capture of
__FUNCTION__ and brace initialization to cleanly avoid both the Most Vexing
Parse and C++20 designator ambiguities, ensuring the true function name is
printed instead of 'operator()'.

Assisted-by: Antigravity:Gemini-3.5-Flash
Signed-off-by: Zygo Blaxell <bees@furryterror.org>
src/bees-trace.cc
src/bees.h