|
Celeritas 0.7-develop+ddcb429
|
Log handle for saving messages for testing. More...
#include <ScopedLogStorer.hh>
Public Types | |
Type aliases | |
| using | VecString = std::vector< std::string > |
Public Member Functions | |
| ScopedLogStorer (Logger *orig, LogLevel min_level) | |
| Construct reference to log to temporarily replace. | |
| ScopedLogStorer (Logger *orig) | |
| Construct reference to log to temporarily replace. | |
| ScopedLogStorer (ScopedLogStorer &&)=default | |
| ScopedLogStorer (ScopedLogStorer const &)=delete | |
| ScopedLogStorer & | operator= (ScopedLogStorer &&)=delete |
| ScopedLogStorer & | operator= (ScopedLogStorer const &)=delete |
| ~ScopedLogStorer () | |
| Restore original logger on destruction. | |
| void | operator() (LogProvenance, LogLevel lev, std::string msg) |
| Save a log message. | |
| bool | empty () const |
| Whether no messages were stored. | |
| VecString const & | messages () const |
| Get saved messages. | |
| VecString const & | levels () const |
| Get corresponding log levels. | |
| void | remove_if_contains (std::string const &s) |
| Delete messages that contain a certain string. | |
| void | print_expected () const |
| Print the expected values. | |
| void | clear () |
| Clear results. | |
| LogLevel | level () const |
| Get the minimum level being recorded. | |
| void | level (LogLevel lev) |
| Change the level to record. | |
| int | float_digits () const |
| Get the minimum level being recorded. | |
| void | float_digits (int fd) |
| Change the level to record. | |
Log handle for saving messages for testing.
Temporarily replace the given logger with this function. This removes ANSI sequences and replaces pointer-like strings with 0x0.
You can use the CELER_LOG_SCOPED environment variable to print the captured log messages as they are written.
Messages may be written concurrently from multiple threads, but the accessors must not be called while other threads are still logging.
shared_ptr<ScopedLogResult>, copyable ScopedLogHandler, and a generic ScopedExchange object.