Hi,
I am trying to control the output Ceres shows when there are errors.
I am starting glog with google::InitGoogleLogging(argv[0]);
and then I define, where I'm testing the output.
class custom_solver_verbose : public google::LogSink {
public:
custom_solver_verbose() : debug(false) {};
virtual void send(google::LogSeverity severity, const char* full_filename,
const char* base_filename, int line,
const struct ::tm* tm_time,
const char* message, size_t message_len) override {
(void )full_filename;
(void )base_filename;
(void )line;
(void )tm_time;
std::string msg(message, message_len);
if (msg.find("Error in evaluating the ResidualBlock") != std::string::npos && !debug) {
return; // Ignore this specific message.
}
if (msg.find("Residual and Jacobian evaluation failed") != std::string::npos && !debug) {
return; // Ignore this specific message.
}
//
// // Log other messages as normal (example: to stderr).
std::cerr << "Custom Log: [" << severity << "] " << msg << std::endl;
}
void setup_verbose(bool debug){
this->debug=debug;
}
private:
bool debug;
};
This has worked until now, but when I have the output:
"E1207 14:42:26.501088 151361 trust_region_minimizer.cc:73] Terminating: Residual and Jacobian evaluation failed." I was unable to 'mute' it.
Is there any way to silence this output? Or to output it into a log file instead of the terminal?
Thanks.