When constructed, logs a message (at "warn" severity); the destructor is guaranteed to be trivial.
This is useful for declaring an instance of this class as a function-static global, so that a warning is logged the first time the program encounters some code, but does not repeat the warning on subsequent encounters within the same process.
For example:
double* SanityCheck(double* data) {
if (!data) {
static const logging::Warn log_once("Bad data!");
return alternative_data();
}
return data;
}
#include <drake/common/text_logging.h>
Public Member Functions | |
| template<typename... Args> | |
| Warn (fmt::format_string< Args... > pattern, Args &&... args) | |
| Warn | ( | fmt::format_string< Args... > | pattern, |
| Args &&... | args ) |