Debugging techniques for SilkPerformer
Using write-to-file for debugging
Another way to debug is to write to a file for each user. This is useful if you want to know the values all users are using. In your header file, add a global Boolean variable that is set to true:
gbDebug : boolean init true;
Then, write a function that writes your input to a file, and put the function in the header file. For example:
function fDebug(sText:string(50000))
var
nUserId, hFile : number;
sOutput: string(55000);
begin
if(gbDebug) then
nUserId := GetUserId();
FOpen(hFile, "c:\\Logs\\User"+string(nUserId)+".txt",
OPT_FILE_ACCESS_READWRITE, OPT_FILE_OPENCREATE);
sOutput := sText \+"\r\n";
FWrite(hFile, sOutput, Strlen(sOutput), OPT_FILE_APPEND);
FClose(hFile);
end;
end fDebug;
var
nUserId, hFile : number;
sOutput: string(55000);
begin
if(gbDebug) then
nUserId := GetUserId();
FOpen(hFile, "c:\\Logs\\User"+string(nUserId)+".txt",
OPT_FILE_ACCESS_READWRITE, OPT_FILE_OPENCREATE);
sOutput := sText \+"\r\n";
FWrite(hFile, sOutput, Strlen(sOutput), OPT_FILE_APPEND);
FClose(hFile);
end;
end fDebug;
Use this fDebug function where you normally put a print statement. Enable or disable it by using the global Boolean variable.
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*