How to redefine clog to tee to original clog and a log file?
问题 I saw a useful start here: http://www.cs.technion.ac.il/~imaman/programs/teestream.html And it works great to make a new stream which goes to both clog and a log file. However, if I try to redefine clog to be the new stream it does not work because the new stream has the same rdbuf() as clog so the following has no effect: clog.rdbuf(myTee.rdbuf()); So how can I modify the tee class to have its own rdbuf() which can then be the target of clog? Thanks. -William 回答1: If you really want to keep