Internally we have a logging function with the interface OurLog(const char *)
. I'd like to be able to use it with an interface similar to std::ostringstream
. In other words, I'd love to have an adaptor object so I can write:
logging_class log;
log << "There are " << num_lights << " lights\n";
And this call OurLog()
as necessary to write the message to the log.
It looks like making buffer class derived from std::streambuf
is the right way to go; how does one go about this? What functions need to be implemented?