morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::observe::ScopedObserveOverride Class Reference

RAII helper that snapshots the global metric and trace sinks and restores them in the destructor. More...

#include <observability.hpp>

Public Member Functions

 ScopedObserveOverride ()
 Snapshots the current metric and trace sinks without changing them.
 ~ScopedObserveOverride ()
 Restores the saved metric and trace sinks.
 ScopedObserveOverride (const ScopedObserveOverride &)=delete
ScopedObserveOverride & operator= (const ScopedObserveOverride &)=delete
 ScopedObserveOverride (ScopedObserveOverride &&)=delete
ScopedObserveOverride & operator= (ScopedObserveOverride &&)=delete

Detailed Description

RAII helper that snapshots the global metric and trace sinks and restores them in the destructor.

Mirrors morph::log::ScopedLoggerOverride's snapshot-only constructor: designed for tests that install their own sink(s) mid-test via setMetricSink() / setTraceSink() and want automatic restoration, so a custom sink never leaks into a later test case. Because both sinks are global state, tests using this guard must run serially — the same constraint ScopedLoggerOverride documents.

Definition at line 270 of file observability.hpp.

Constructor & Destructor Documentation

◆ ScopedObserveOverride()

morph::observe::ScopedObserveOverride::ScopedObserveOverride ( )
inline

Snapshots the current metric and trace sinks without changing them.

Definition at line 273 of file observability.hpp.

◆ ~ScopedObserveOverride()

morph::observe::ScopedObserveOverride::~ScopedObserveOverride ( )
inline

Restores the saved metric and trace sinks.

Definition at line 290 of file observability.hpp.


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