|
Celeritas 0.7.0-dev.179+develop.ec08af0c9
|
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 () | |
| Restore original logger on destruction. | |
| CELER_DEFAULT_MOVE_DELETE_COPY (ScopedLogStorer) | |
| Prevent copying but allow moving. | |
| 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 | 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.