Log like stringstream (stdlib)
Posted on 2006-10-27
I have a class for Logging called "Log". It has a method for writing to the log.... write(string).
mylog.write("This message will self destuct in 5 seconds...");
But when I want to pass a message which contains mixed vars, I do this
ss << "This message will self desctuct in " << countdown << " seconds");
but what I want to do is this:
mylog << "This message will self destrict in " << coundown << "seconds");
It would really tidy up my code.
I don't know enough about the << operator to be sure about what I'm doing.
Any pointers or a quick example?
Here is my Log.h
Log(); // Log to console
Log(string filename); // log to file