LogParams Object

Applies to TestComplete 15.63, last modified on April 23, 2024

Description

The LogParams object is used in project events that occur upon posting messages to the test log. This object contains a number of properties that specify text and attributes of the posted message. You can modify these properties within an event handler to change message text, its color, font style and other attributes.

For example: suppose that TestComplete posts an error message to notify you that an unexpected window has appeared. Before TestComplete posts this message, it creates the LogParams object, fills its properties with data, generates the OnUnexpectedWindow event and passes this LogParams object as a parameter to the event handler. Properties of the LogParams object specify text, priority, font style and other attributes of the posted message. The event handler can modify these properties, so TestComplete will post text specified in the event handler, but not the text used by default.

All properties of the LogParams object are Read/Write.

Members

Example

The code below demonstrates how you can use the LogParams object to specify settings for the messages posted to the test log when an unexpected window appears.

JavaScript, JScript

function EventControl1_OnUnexpectedWindow(Sender, Window, LogParams)
{
  LogParams.MessageText = "An unexpected window has appeared.";
  // Specifies the string that will be posted to the Details panel
  LogParams.AdditionalText = "The " + Window.Name + " window has appeared.";
  // ...
  LogParams.Priority = pmHighest;
  LogParams.FontStyle.Bold = true;
  // ...
  // Specifies the color settings
  LogParams.FontColor = clSilver;
  LogParams.Color = clFuchsia;
}

Python

def EventControl1_OnUnexpectedWindow(Sender, Window, LogParams):
  LogParams.MessageText = "An unexpected window has appeared."
  # Specifies the string that will be posted to the Details panel
  LogParams.AdditionalText = "The " + Window.Name + " window has appeared."
  # ....
  LogParams.Priority = pmHighest
  LogParams.FontStyle.Bold = True
  # ...
  # Specifies the color settings
  LogParams.FontColor = clSilver
  LogParams.Color = clFuchsia

VBScript

Sub EventControl1_OnUnexpectedWindow(Sender, Window, LogParams)

  LogParams.MessageText = "An unexpected window has appeared."
  ' Specifies the string that will be posted to the Details panel
  LogParams.AdditionalText = "The " & Window.Name & " window has appeared."
  ' ...
  LogParams.Priority = pmHighest
  LogParams.FontStyle.Bold = True
  ' ...
  ' Specifies the color settings
  LogParams.FontColor = clSilver
  LogParams.Color = clFuchsia
  
End Sub

DelphiScript

function EventControl1_OnUnexpectedWindow(Sender, Window, LogParams);
begin
  LogParams.MessageText := 'An unexpected window has appeared.';
  // Specifies the string that will be posted to the Details panel
  LogParams.AdditionalText := 'The ' + Window.Name + ' window has appeared.';
  // ...
  LogParams.Priority := pmHighest;
  LogParams.FontStyle.Bold := True;
  // ...
  // Specifies the color settings
  LogParams.FontColor := clSilver;
  LogParams.Color := clFuchsia;

end;

C++Script, C#Script

function EventControl1_OnUnexpectedWindow(Sender, Window, LogParams)
{
  LogParams["MessageText"] = "An unexpected window has appeared.";
  // Specifies the string that will be posted to the Details panel
  LogParams["AdditionalText"] = "The " + Window["Name"] + "window has appeared.";
  // ...
  LogParams["Priority"] = pmHighest;
  LogParams["FontStyle"]["Bold"] = true;
  // ...
  // Specifies the color settings
  LogParams["FontColor"] = clSilver;
  LogParams["Color"] = clFuchsia;
}

See Also

Test Log
Log Object

Highlight search results