Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Introduce scope failure threshold helper #3290

Merged
merged 3 commits into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Core/include/Acts/Utilities/Logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,19 @@ class ThresholdFailure : public std::runtime_error {
using std::runtime_error::runtime_error;
};

/// Helper class that changes the failure threshold for the duration of its
/// lifetime.
class ScopedFailureThreshold {
public:
ScopedFailureThreshold(Level level) : m_previousLevel(getFailureThreshold()) {
setFailureThreshold(level);
}
~ScopedFailureThreshold() { setFailureThreshold(m_previousLevel); }

private:
Level m_previousLevel;
};

/// @brief abstract base class for printing debug output
///
/// Implementations of this interface need to define how and where to @a print
Expand Down
Loading