59 using iterator = boost::log::attribute_set::iterator;
70 auto result = boost::log::core::get()->add_thread_attribute(
72 boost::log::attributes::constant<bool>(
true));
74 iterator_ = result.first;
79 if (iterator_.has_value()) {
80 boost::log::core::get()->remove_thread_attribute(*iterator_);
85 scoped_attribute(
const scoped_attribute&) =
delete;
86 scoped_attribute& operator=(
const scoped_attribute&) =
delete;
89 scoped_attribute(scoped_attribute&& other) noexcept
90 : iterator_(std::move(other.iterator_)) {
91 other.iterator_.reset();
96 if (iterator_.has_value()) {
97 boost::log::core::get()->remove_thread_attribute(*iterator_);
99 iterator_ = std::move(other.iterator_);
100 other.iterator_.reset();
106 std::optional<iterator> iterator_;