diff --git a/src/bees.cc b/src/bees.cc index 98ce192..d40a964 100644 --- a/src/bees.cc +++ b/src/bees.cc @@ -42,11 +42,16 @@ do_cmd_help(char *argv[]) // tracing ---------------------------------------- thread_local BeesTracer *BeesTracer::tl_next_tracer = nullptr; +thread_local bool BeesTracer::tl_first = true; thread_local bool BeesTracer::tl_silent = false; BeesTracer::~BeesTracer() { if (!tl_silent && current_exception()) { + if (tl_first) { + BEESLOGNOTICE("--- BEGIN TRACE --- exception ---"); + tl_first = false; + } try { m_func(); } catch (exception &e) { @@ -61,6 +66,7 @@ BeesTracer::~BeesTracer() tl_next_tracer = m_next_tracer; if (!m_next_tracer) { tl_silent = false; + tl_first = true; } } diff --git a/src/bees.h b/src/bees.h index 48f94ad..52f4031 100644 --- a/src/bees.h +++ b/src/bees.h @@ -197,6 +197,7 @@ class BeesTracer { thread_local static BeesTracer *tl_next_tracer; thread_local static bool tl_silent; + thread_local static bool tl_first; public: BeesTracer(function f, bool silent = false); ~BeesTracer();