![]() |
OpenMS
|
RAII guard that temporarily removes a stream from a LogStream and re-inserts it on scope exit. More...
#include <OpenMS/CONCEPT/LogStream.h>
Public Member Functions | |
| LogSinkGuard (LogStream &log_stream, std::ostream &stream) | |
| Construct a guard that removes the stream and re-inserts it on destruction. | |
| ~LogSinkGuard () | |
| Destructor re-inserts the stream. | |
| LogSinkGuard (const LogSinkGuard &)=delete | |
| LogSinkGuard & | operator= (const LogSinkGuard &)=delete |
| LogSinkGuard (LogSinkGuard &&)=delete | |
| LogSinkGuard & | operator= (LogSinkGuard &&)=delete |
Private Attributes | |
| LogStream & | log_stream_ |
| std::ostream & | stream_ |
RAII guard that temporarily removes a 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.
Example usage:
|
inline |
Construct a guard that removes the stream and re-inserts it on destruction.
| log_stream | The LogStream to remove the stream from (and re-insert into on destruction) |
| stream | The stream to temporarily remove (e.g., std::cout) |
|
inline |
Destructor re-inserts the stream.
|
delete |
|
delete |
|
delete |
|
delete |
|
private |
|
private |