Log.Enabled Property

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

The Enabled property lets you allow or disallow the posting of folders and messages of all kinds to the test log. If the property is True, folders and messages you post to the test log via Log.CreateFolder, Log.Message, Log.Event, Log.Error, Log.Warning, Log.File, Log.Picture or Log.Link as well as messages posted to the test log by TestComplete itself will actually be saved in the test log. If the property is False, all of these folders and messages will be ignored.

Declaration

Log.Enabled

Read-Write Property Boolean

Applies To

The property is applied to the following object:

Property Value

True if the posting of folders and messages to the test log is allowed and False otherwise.

Remarks

This property is not applied to child nodes of the test log. Folders and messages will be posted to child logs even if the Enabled property value is False.

Example

The code below disables posting messages to the test log and then enables it, and shows which messages are posted to the resulting test log and which are not.

JavaScript, JScript

function EnableTestLog()
{
  // Posts a message to the test log
  Log.Message("First message.");
  
  // Disables posting messages to the test log
  Log.Enabled = false;
  // Posts a warning to the test log
  Log.Warning("This warning won't be posted.");
  // ...
  // All the messages are ignored
  // ...
  
  // Enables posting messages to the test log
  Log.Enabled = true;
  
  // Posts the event to the test log
  Log.Event("Test event.");
}

/*
The procedure produces the following output:


First message.
Test event.
*/

Python

def EnableTestLog():
  # Posts a message to the test log
  Log.Message("First message.")
  # Disables posting messages to the test log
  Log.Enabled = False
  # Posts a warning to the test log
  Log.Warning("This warning won't be posted.")
  # ...
  # All the messages are ignored
  # ...
  # Enables posting messages to the test log
  Log.Enabled = True
  # Posts the event to the test log
  Log.Event("Test event.")

# The procedure produces the following output:
# First message.
# Test event.

VBScript

Sub EnableTestLog()

  ' Posts a message to the test log
  Log.Message("First message.")
  
  ' Disables posting messages to the test log
  Log.Enabled = false
  ' Posts a warning to the test log
  Log.Warning("This warning won't be posted.")
  ' ...
  ' All the messages are ignored
  ' ...
  
  ' Enables posting messages to the test log
  Log.Enabled = true
  
  ' Posts the event to the test log
  Log.Event("Test event.")
     
End Sub

' The procedure produces the following output:

' First message.
' Test event.

DelphiScript

function EnableTestLog;
begin
  // Posts a message to the test log
  Log.Message('First message.');
  
  // Disables posting messages to the test log
  Log.Enabled := false;
  // Posts a warning to the test log
  Log.Warning('This warning won''t be posted.');
  // ...
  // All the messages are ignored
  // ...
  
  // Enables posting messages to the test log
  Log.Enabled := true;
  
  // Posts the event to the test log
  Log.Event('Test event.');
end;

{
The procedure produces the following output:


First message.
Test event.
}

C++Script, C#Script

function EnableTestLog()
{
  // Posts a message to the test log
  Log["Message"]("First message.");
  
  // Disables posting messages to the test log
  Log["Enabled"] = false;
  // Posts a warning to the test log
  Log["Warning"]("This warning won't be posted.");
  // ...
  // All the messages are ignored
  // ...
  
  // Enables posting messages to the test log
  Log["Enabled"] = true;
  
  // Posts the event to the test log
  Log["Event"]("Test event.");
}

/*
The procedure produces the following output:


First message.
Test event.
*/

See Also

Test Results
LockEvents Method
UnlockEvents Method

Highlight search results