Page 1 of 1
Trace Window Usage
Posted: Mon 25. Oct 2010, 18:54
Is there any way to increase the number of lines displayed in the Trace Window?
I like to write programs that have elaborate log files that log every phase of the algorithm during execution. The trace window works perfectly for that.
Is there any way that the contents of the trace window could be dumped into a text file?
Re: Trace Window Usage
Posted: Mon 25. Oct 2010, 19:35
MrCreosote wrote:Is there any way that the contents of the trace window could be dumped into a text file?
But how about this: Open a txt file on your own using the normal file class of the scripting language.
Then write a function called 'MyTrace(const string &in message) ' that does both, call the function 'Trace' to put the contents in the trace window and that writes the string to the file.
Could look something like this (the following lines are not compiled code, they are just written from the top of my head):
Code: Select all
file logFile; // The log file object of the script
void MyTrace(const string&in message)
Trace(message + "\r\n"); // Write content to the trace window
// Now write the same message line to the log file. 'logFile' must be an object of class 'file' that has been opened in txt mode.
if (!logFile.Write(message + "\r\n"))
Trace("Can't write to log file!\r\n");
if (!logFile.Open("SomeFile.txt", FILE_MODE_CREATE | FILE_SHARE_DENY_NONE))
MessageBox("Unable to open log file");
MyTrace("This is an example text that will end up both in the Trace Window and in the log file");