boost::format CustomFormat(const char* s) { using namespace boost::io; boost::format format(s); format.exceptions(all_error_bits ^ (too_many_args_bit | too_few_args_bit)); return format; }
formatter() { try{ fmt_ = boost::format(getenv("IPI_LOG_FORMAT") ? getenv("IPI_LOG_FORMAT") : "[%1%] "); }catch(const std::exception& e){ std::cerr << "Could not used IPI_LOG_FORMAT!\n" << fmt_ << "\n" << e.what() << std::endl; abort(); } fmt_.exceptions( boost::io::all_error_bits ^ ( boost::io::too_many_args_bit | boost::io::too_few_args_bit ) ); }