Celeritas
0.5.0-56+6b053cd
|
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 |
void | clear () |
Clear results. | |
LogLevel | level () const |
Get the minimum level being recorded. | |
void | level (LogLevel lev) |
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.