|
ORE Studio 0.0.4
|
RAII guard that adds a thread-local attribute to Boost.Log for the duration of its scope. More...
#include <scoped_attribute.hpp>


Public Types | |
| using | iterator = boost::log::attribute_set::iterator |
Public Member Functions | |
| scoped_attribute (const std::string &attribute_name) | |
| Constructs a scoped attribute guard. | |
| scoped_attribute (const scoped_attribute &)=delete | |
| scoped_attribute & | operator= (const scoped_attribute &)=delete |
| scoped_attribute (scoped_attribute &&other) noexcept | |
| scoped_attribute & | operator= (scoped_attribute &&other) noexcept |
RAII guard that adds a thread-local attribute to Boost.Log for the duration of its scope.
This class adds a named boolean attribute with value true to the thread-local attribute set in Boost.Log's core. The attribute is automatically removed when the guard goes out of scope.
All log records created on the same thread while the guard is active will have this attribute, including records from nested function calls. This makes it useful for marking entire code paths that should be treated specially by certain sinks (e.g., skipping telemetry sinks to prevent recursive logging).
Example usage:
|
explicit |
Constructs a scoped attribute guard.
Adds a boolean attribute with the given name and value true to the thread-local attribute set.
| attribute_name | The name of the attribute to add. |