I'm working on, to write the debug statements to logfile or console depends on working environment.
What I have did:
Expand|Select|Wrap|Line Numbers
- streambuf *psbuf;
- ofstream logFile;
- logFile.open(LOGFILE);
- psbuf = logFile.rdbuf();
- cout.rdbuf(psbuf);
The situation is, I like to include the date/time, in front of each message.
e.g cout<<"Hello"<<endl;
will log -
[10/10/2010 12:24:32] Hello
Hope I'm clear in my question.
Many Thanks