RAII guard that temporarily removes an attached stream from a LogStream and re-inserts it on scope exit.
This class provides exception-safe temporary removal of output streams from LogStream objects. Use this when you need to temporarily suppress logging to a specific stream (e.g., cout) during operations that may throw exceptions.
- Note
- The guard acts only on a stream that is attached when it is constructed; for an unattached stream it does nothing (will not insert on scope exit).
-
The OPENMS_LOG_* macros write to thread-local streams whose sink list is copied from the global one on first access. Guard the thread-local stream (getThreadLocalLog*()), not the global one, to suppress output reliably.
Example usage:
some_operation_that_may_throw();
RAII guard that temporarily removes an attached stream from a LogStream and re-inserts it on scope ex...
Definition LogStream.h:518
Logger::LogStream & getThreadLocalLogInfo()
Get thread-local info log stream.