Pascal Scripting: OnLog Parameters

There is one optional parameter that is supported by the [Run] section. This is:

OnLog

When combined with the logoutput flag, this parameter specifies the name of a procedure that is to be called for each line of the program's output instead of directly including it in the log file.

The function must be a custom function in the [Code] section having the following prototype: procedure MyOnLog(const S: String; const Error, FirstLine: Boolean);.

See ExecAndLogOutput for an explanation of parameters S, Error and FirstLine.

Example:
[Run]
Filename: "{app}\MyConsoleProg.exe"; OnLog: MyOnLog; Flags: logoutput

Here is an example of a [Code] section containing the procedure used above. Function Log is a support function and therefore not included in this [Code] section.

[Code]
procedure MyOnLog(const S: String; const Error, FirstLine: Boolean);
begin
  if not Error and FirstLine then
    Log('Output:');
  Log(S);
end;