ifw-fnd 2.0.1
 
Loading...
Searching...
No Matches
ifw::fnd::ScopedTracer Class Reference

RAII tracer used by FNDTRACE. More...

#include <logger.hpp>

Public Member Functions

 ScopedTracer (std::string location, std::string extra) noexcept
 
 ~ScopedTracer ()
 
 ScopedTracer (const ScopedTracer &)=delete
 
ScopedTraceroperator= (const ScopedTracer &)=delete
 
 ScopedTracer (ScopedTracer &&)=delete
 
ScopedTraceroperator= (ScopedTracer &&)=delete
 

Detailed Description

RAII tracer used by FNDTRACE.

Emits ENTERING on construction and LEAVING + elapsed time on destruction, both at LogLevel::TRACE. Indentation grows with nesting depth (one "=" per level, thread-local counter), so nested traces in the same thread render with visual hierarchy.

Cost when TRACE is disabled: a single atomic load of the installed logger plus one level comparison per construct/destruct. The pre-formatted location/extra strings are passed in by the macro only when TRACE is enabled, so disabled traces don't pay for formatting.

Re-entry from the destructor of a function that early-returns from multiple branches is intentional: each LEAVING corresponds to the scope actually closing, including exception unwinds. Exceptions must not escape the destructor; emissions are protected.

Constructor & Destructor Documentation

◆ ScopedTracer() [1/3]

ifw::fnd::ScopedTracer::ScopedTracer ( std::string location,
std::string extra )
noexcept

◆ ~ScopedTracer()

ifw::fnd::ScopedTracer::~ScopedTracer ( )

◆ ScopedTracer() [2/3]

ifw::fnd::ScopedTracer::ScopedTracer ( const ScopedTracer & )
delete

◆ ScopedTracer() [3/3]

ifw::fnd::ScopedTracer::ScopedTracer ( ScopedTracer && )
delete

Member Function Documentation

◆ operator=() [1/2]

ScopedTracer & ifw::fnd::ScopedTracer::operator= ( const ScopedTracer & )
delete

◆ operator=() [2/2]

ScopedTracer & ifw::fnd::ScopedTracer::operator= ( ScopedTracer && )
delete

The documentation for this class was generated from the following files: