smartinspectpython.sisession

Module: sisession.py

Revision History

Date Version Description
2023/09/29 3.0.22.0 Set Logger.propagate = False so that our exception capture process does not forward the message on to other loggers.
Changed methods that support SystemLogger functionality to allow bypass of logging to the system logger.
2023/09/27 3.0.21.0 Added SystemLogger functionality to allow logging to system logs.
2023/09/03 3.0.20.0 Changed all Session.LogX method signatures to use the SIColors enum type, or an integer value in ARGB format.
2023/07/11 3.0.16.0 Changed Session.GetMethodName method to use inspect.stack(0) instead of inspect.stack() to improve performace.
2023/06/28 3.0.14.0 Changed Session class to use temporary logger to capture exception details in LogException method.
2023/06/23 3.0.13.0 Changed Session LogAssigned method to properly format the LogMessage title value.
2023/06/17 3.0.12.0 Changed Session EnterMethod, LeaveMethod to include source file.
Added default title to LogAppDomain method.
Added exception handling in Session.LogSystem for user name value. It was failing on Windows WSL systems, returning some sort of permissions error.
2023/06/17 3.0.11.0 Added *args support to Session class methods: LogDebug, LogVerbose, LogMessage, LogWarning, LogException, and LogFatal methods.
2023/06/15 3.0.9.0 Changed the Session.CurrentMethodName, CurrentMethodNameClass, and CurrentMethodNameClassNamespace properties to static methods.
2023/05/30 3.0.0.0 Initial Version.

@export
class SISession:

Logs all kind of data and variables to the SmartInspect Console or to a log file.

The SISession class offers dozens of useful methods for sending any kind of data with the assistance of its SISession.Parent. Sessions can send simple messages, warnings, errors and more complex things like pictures, objects, exceptions, system information and much more. They are even able to send variable watches, generate illustrated process and thread information or control the behavior of the SmartInspect Console. It is possible, for example, to clear the entire log in the Console by calling the ClearLog method.

Please note that log methods of this class do nothing and return immediately if the session is currently not active (Active=False), its parent is disabled (Parent.Enabled=False), or the Level is not sufficient.

Threadsafety:

This class is fully thread-safe.

SISession(parent, name: str)

Initializes a new SISession instance with the default color and the specified parent and name.

Arguments:
  • parent (SmartInspect): The parent of the new session.
  • name (str): The name of the new session.
Active: bool

Gets the Active property value.

Returns:

True if this session can send log message data to the active protocols; otherwise, False to suspend logging activity.

Specifies if the session is currently active.

If this property is set to false, all logging methods of this class will return immediately and do nothing. Please note that the Parent of this session also needs to be SmartInspect.Enabled in order to log information.

This property is especially useful if you are using multiple sessions at once and want to deactivate a subset of these sessions. To deactivate all your sessions, you can use the SmartInspect.Enabled property of the Parent.

Gets the ColorBG property value.

Returns:

The background color used for this session in the SmartInspect Console.

The session color helps you to identify Log Entries from different sessions in the SmartInspect Console by changing the background color.

Gets the Level property value.

Returns:

The log level of this session.

Each SISession object can have its own log level. A log message is only logged if its log level is greater than or equal to the log level of a session AND the session Parent. Log levels can thus be used to limit the logging output to important messages only.

SystemLogger: logging.Logger

A system Logger object, which can be used to write messages to a system-based log file as well as the SmartInspect log.

Returns:

The SystemLogger property value.

This can be useful when adding logging to third-party products that require a common logging mechanism, but also allows you to capture extended logging information to a SmartInspect console.

The following methods will write information to a Logger object assigned to the SystemLogger property:
LogDebug - calls _LOGGER.debug(msg) to log a message.
LogVerbose - calls _LOGGER.debug(msg) to log a message.
LogMessage - calls _LOGGER.info(msg) to log a message.
LogWarning - calls _LOGGER.warning(msg) to log a message.
LogError - calls _LOGGER.error(msg) to log a message.
LogException - calls _LOGGER.exception(ex) to log an exception message.
LogFatal - calls _LOGGER.critical(msg) to log a message.

Sample Code

# package imports.
from smartinspectpython.siauto import *

# set smartinspect connections, and enable logging.
SIAuto.Si.Connections = "tcp(host=localhost,port=4228,timeout=30000)"
SIAuto.Si.Enabled = True

# get smartinspect logger reference.
_logsi:SISession = SIAuto.Main

# configure system logging (to file).
import logging
import logging.handlers
import os
exedir = os.path.dirname(sys.argv[0])
logfilePath:str = exedir + "/logfiles/"
handler = logging.handlers.WatchedFileHandler(logfilePath+"test_SystemLogger_Output.log")
formatter = logging.Formatter(logging.BASIC_FORMAT)
handler.setFormatter(formatter)
_LOGGER = logging.getLogger()
_LOGGER.setLevel("INFO")
_LOGGER.addHandler(handler)

# get smartinspect logger reference, and add system logging.
_logsi:SISession = SIAuto.Main
_logsi.SystemLogger = _LOGGER

# data used by various tests.
argsVar1:str="Argument 1 Value"
argsVar2:int=1000

# log some messages of different logging levels.
# note that the "LogDebug" messages will not appear in the system logging file due to "INFO" system logging level.
_logsi.LogDebug("This is a debug message.  It will not be displayed if Level=Verbose or above.")
_logsi.LogDebug("This is a debug message with *args: str1='%s', int2=%i.  It will not be displayed if Level=Verbose or above.", argsVar1, argsVar2)
_logsi.LogVerbose("This is a verbose message.  It will not be displayed if Level=Message or above.")
_logsi.LogVerbose("This is a verbose message with *args: str1='%s', int2=%i.  It will not be displayed if Level=Message or above.", argsVar1, argsVar2)
_logsi.LogMessage("This is a message.  It will not be displayed if Level=Warning or above.")
_logsi.LogMessage("This is a message with *args: str1='%s', int2=%i.  It will not be displayed if Level=Warning or above.", argsVar1, argsVar2)
_logsi.LogWarning("This is a warning message.  It will not be displayed if Level=Error or above.")
_logsi.LogWarning("This is a warning message with *args: str1='%s', int2=%i.  It will not be displayed if Level=Error or above.", argsVar1, argsVar2)
_logsi.LogError("This is a error message.  It will not be displayed if Level=Fatal or above.")
_logsi.LogError("This is a error message with *args: str1='%s', int2=%i.  It will not be displayed if Level=Fatal or above.", argsVar1, argsVar2)
_logsi.LogFatal("This is a fatal error message.")
_logsi.LogFatal("This is a fatal error message with *args: str1='%s', int2=%i.", argsVar1, argsVar2)

# log an exception.
try:

    raise Exception("This is a forced exception used to test the LogException method.")

except Exception as ex:

    _logsi.LogException("LogException - with Custom title, exception details in SI Console viewer area.", ex)
    _logsi.LogException(None, ex)


Create A New Session For Each Module

# package imports.
from smartinspectpython.siauto import *

# set smartinspect connections, and enable logging.
SIAuto.Si.Connections = "tcp(host=localhost,port=4228,timeout=30000)"
SIAuto.Si.Enabled = True

# get smartinspect logger reference.
_logsi:SISession = SIAuto.Main

# configure system logging (to file).
import logging
import logging.handlers
import os
exedir = os.path.dirname(sys.argv[0])
logfilePath:str = exedir + "/logfiles/"
handler = logging.handlers.WatchedFileHandler(logfilePath+"test_SystemLogger_Output.log")
formatter = logging.Formatter(logging.BASIC_FORMAT)
handler.setFormatter(formatter)
_LOGGER = logging.getLogger()
_LOGGER.setLevel("INFO")
_LOGGER.addHandler(handler)

# get smartinspect logger reference; create a new session for this module name.
_logsi:SISession = SIAuto.Si.GetSession(__name__)
if (_logsi == None):
    _logsi = SIAuto.Si.AddSession(__name__, True)
_logsi.SystemLogger = _LOGGER

# data used by various tests.
argsVar1:str="Argument 1 Value"
argsVar2:int=1000

# log some messages of different logging levels.
# note that the "LogDebug" messages will not appear in the system logging file due to "INFO" system logging level.
_logsi.LogDebug("This is a debug message.  It will not be displayed if Level=Verbose or above.")
_logsi.LogDebug("This is a debug message with *args: str1='%s', int2=%i.  It will not be displayed if Level=Verbose or above.", argsVar1, argsVar2)
_logsi.LogVerbose("This is a verbose message.  It will not be displayed if Level=Message or above.")
_logsi.LogVerbose("This is a verbose message with *args: str1='%s', int2=%i.  It will not be displayed if Level=Message or above.", argsVar1, argsVar2)
_logsi.LogMessage("This is a message.  It will not be displayed if Level=Warning or above.")
_logsi.LogMessage("This is a message with *args: str1='%s', int2=%i.  It will not be displayed if Level=Warning or above.", argsVar1, argsVar2)
_logsi.LogWarning("This is a warning message.  It will not be displayed if Level=Error or above.")
_logsi.LogWarning("This is a warning message with *args: str1='%s', int2=%i.  It will not be displayed if Level=Error or above.", argsVar1, argsVar2)
_logsi.LogError("This is a error message.  It will not be displayed if Level=Fatal or above.")
_logsi.LogError("This is a error message with *args: str1='%s', int2=%i.  It will not be displayed if Level=Fatal or above.", argsVar1, argsVar2)
_logsi.LogFatal("This is a fatal error message.")
_logsi.LogFatal("This is a fatal error message with *args: str1='%s', int2=%i.", argsVar1, argsVar2)

# log an exception.
try:

    raise Exception("This is a forced exception used to test the LogException method.")

except Exception as ex:

    _logsi.LogException("LogException - with Custom title, exception details in SI Console viewer area.", ex)
    _logsi.LogException(None, ex)

Name: str

Gets the Name property value.

Returns:

The session name used for Log Entries.

The session name helps you to identify Log Entries from different sessions in the SmartInspect Console. If you set this property to null, the session name will be empty when sending Log Entries.

Parent

Gets the Name property value.

Returns:

The parent SmartInspect instance that owns the session.

The parent of a session is a SmartInspect instance. It is responsible for sending the packets to the SmartInspect Console or for writing them to a file. If the SmartInspect.Enabled property of the parent is false, all logging methods of this class will return immediately and do nothing.

def AddCheckpoint( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, details: str = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Increments the counter of a named checkpoint and logs a message with a custom log level and an optional message.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The name of the checkpoint to increment.
  • details (str): An optional message to include in the resulting log entry. Can be null / None.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method increments the counter for the given checkpoint and then logs a message using "%checkpoint% #N" as title where %checkpoint% stands for the name of the checkpoint and N for the incremented counter value. The initial value of the counter for a given checkpoint is 0. Specify the details parameter to include an optional message in the resulting log entry. You can use the ResetCheckpoint method to reset the counter to 0 again.

def ClearAll(self, level: smartinspectpython.silevel.SILevel = None) -> None:

Resets the whole Console.

Arguments:
  • level (SILevel): The log level of this method call.

This method resets the whole Console. This means that all Watches, Log Entries, Process Flow entries and AutoViews will be deleted.

def ClearAutoViews(self, level: smartinspectpython.silevel.SILevel = None) -> None:

Clears all AutoViews in the Console.

Arguments:
  • level (SILevel): The log level of this method call.
def ClearLog(self, level: smartinspectpython.silevel.SILevel = None) -> None:

Clears all Log Entries in the Console.

Arguments:
  • level (SILevel): The log level of this method call.
def ClearProcessFlow(self, level: smartinspectpython.silevel.SILevel = None) -> None:

Clears all Process Flow entries in the Console.

Arguments:
  • level (SILevel): The log level of this method call.
def ClearWatches(self, level: smartinspectpython.silevel.SILevel = None) -> None:

Clears all Watches in the Console.

Arguments:
  • level (SILevel): The log level of this method call.
@staticmethod
def CurrentMethodName() -> str:

Returns the fully-qualified method name of the current stack level in the form of "MethodName".

Returns:

The fully-qualified method name of the current stack level in the form of "MethodName".

Reflection is used to determine the method name. If method info could not be queried, "<Unknown>" is returned.

No exception will be thrown by this method.

@staticmethod
def CurrentMethodNameClass() -> str:

Returns the fully-qualified method name of the current stack level in the form of "ClassName.MethodName".

Returns:

The fully-qualified method name of the current stack level in the form of "ClassName.MethodName".

Reflection is used to determine the method name. If method info could not be queried, "<Unknown>" is returned.

No exception will be thrown by this method.

@staticmethod
def CurrentMethodNameClassNamespace() -> str:

Returns the fully-qualified method name of the current stack level in the form of "Namespace.ClassName.MethodName".

Returns:

The fully-qualified method name of the current stack level in the form of "Namespace.ClassName.MethodName".

Reflection is used to determine the method name. If method info could not be queried, "<Unknown>" is returned.

No exception will be thrown by this method.

def DecCounter( self, level: smartinspectpython.silevel.SILevel = None, name: str = None) -> None:

Decrements a named counter by one and automatically sends its name and value as integer watch with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The name of the counter to log.

The SISession class tracks a list of so called named counters. A counter has a name and a value of type integer. This method decrements the value for the specified counter by one and then sends a normal integer watch with the name and value of the counter. The initial value of a counter is 0. To reset the value of a counter to 0 again, you can call ResetCounter.

See IncCounter for a method which increments the value of a named counter instead of decrementing it.

def EnterMethod( self, level: smartinspectpython.silevel.SILevel = None, methodName: str = None) -> None:

Enters a method by using a custom log level. The resulting method name consists of the FullName of the type of the supplied instance parameter, followed by a dot and the supplied methodName argument.

Arguments:
  • level (SILevel): The log level of this method call.
  • methodName (str): The name of the method; otherwise null to retrieve the current method name from inspect data.

The EnterMethod method notifies the Console that a new method has been entered. The Console includes the method in the method hierarchy. If this method is used consequently, a full call stack is visible in the Console which helps locating bugs in the source code. Please see the LeaveMethod method as the counter piece to EnterMethod.

If the methodName is null, then the currently executing method name is derived from calling inspect.stack. The function name, module name, and source line number are displayed.

This method uses the SmartInspect.DefaultLevel value if the level parameter is set to None (default). Otherwise, the specified level is utilized.

def EnterProcess( self, level: smartinspectpython.silevel.SILevel = None, processName: str = None) -> None:

Enters a new process by using a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • processName (str): The name of the process.

The EnterProcess method notifies the Console that a new process has been entered. The Console displays this process in the Process Flow toolbox. Please see the LeaveProcess method as the counter piece to EnterProcess.

This method uses the SmartInspect.DefaultLevel value if the level parameter is set to None (default). Otherwise, the specified level is utilized.

def EnterThread( self, level: smartinspectpython.silevel.SILevel = None, threadName: str = None) -> None:

Enters a new thread by using a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • threadName (str): The name of the thread.

The EnterThread method notifies the Console that a new thread has been entered. The Console displays this thread in the Process Flow toolbox. Please see the LeaveThread method as the counter piece to EnterThread.

This method uses the SmartInspect.DefaultLevel value if the level parameter is set to None (default). Otherwise, the specified level is utilized.

@staticmethod
def GetMethodName( stackLevel: int = 0, includeNameSpace: bool = False, includeClassName: bool = False) -> str:

Returns the callers method name for the specified stack level.

Arguments:
  • stackLevel (int): The Stack Frame level to query - defaults to 1 if zero is specified.
  • includeSourcePos (bool): True to append the module name and source line # to the method name; otherwise False (default) to return only the method name.
  • includeNameSpace (bool): True to prefix the returned method name with the name-space identifier; otherwise False to not return the name-space identifier.
  • includeClassName (bool): True to prefix the returned method name with the class name; otherwise False to not return the class name.
Returns:

The callers method name.

Reflection is used to determine the method name for the specified stack level.
If method info could not be queried, "<Unknown>" is returned.

No exception will be thrown by this method.

def IncCounter( self, level: smartinspectpython.silevel.SILevel = None, name: str = None) -> None:

Increments a named counter by one and automatically sends its name and value as integer watch with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The name of the counter to log.

The SISession class tracks a list of so called named counters. A counter has a name and a value of type integer. This method increments the value for the specified counter by one and then sends a normal integer watch with the name and value of the counter. The initial value of a counter is 0. To reset the value of a counter to 0 again, you can call ResetCounter.

See DecCounter for a method which decrements the value of a named counter instead of incrementing it.

def IsOn(self, level: smartinspectpython.silevel.SILevel = None) -> bool:

Indicates if information can be logged for a certain log level or not.

Arguments:
  • level (SILevel): The log level to check for.
Returns:

True if information can be logged and false otherwise.

This method is used by the logging methods in this class to determine if information should be logged or not. When extending the SISession class by adding new log methods to a derived class it is recommended to call this method first.

def LeaveMethod( self, level: smartinspectpython.silevel.SILevel = None, methodName: str = None) -> None:

Leaves a method by using a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • methodName (str): The name of the method; otherwise null to retrieve the current method name from inspect data.

The LeaveMethod method notifies the Console that a method has been left. The Console closes the current method in the method hierarchy. If this method is used consequently, a full call stack is visible in the Console which helps locating bugs in the source code. Please see the EnterMethod method as the counter piece to EnterMethod.

This method uses the SmartInspect.DefaultLevel value if the level parameter is set to None (default). Otherwise, the specified level is utilized.

def LeaveProcess( self, level: smartinspectpython.silevel.SILevel = None, processName: str = None) -> None:

Leaves a process by using a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • processName (str): The name of the process.

The LeaveProcess method notifies the Console that a process has finished. The Console displays this change in the Process Flow toolbox. Please see the EnterProcess method as the counter piece to LeaveProcess.

This method uses the SmartInspect.DefaultLevel value if the level parameter is set to None (default). Otherwise, the specified level is utilized.

def LeaveThread( self, level: smartinspectpython.silevel.SILevel = None, threadName: str = None) -> None:

Leaves a thread by using a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • threadName (str): The name of the thread.

The LeaveThread method notifies the Console that a thread has finished. The Console displays this change in the Process Flow toolbox. Please see the EnterThread method as the counter piece to LeaveThread.

This method uses the SmartInspect.DefaultLevel value if the level parameter is set to None (default). Otherwise, the specified level is utilized.

def LogAppDomain( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs information about an application and its setup with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs information about the current application and its setup. This is not quite the same as the C# equivalent, but it does log similar properties.

def LogArray( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, oArray: array.array = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs the content of an array with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console - "Current stack trace" is used if one is not supplied.
  • oArray (array): The array to log.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method iterates through the supplied array and calls SIObjectRenderer.RenderObject to render every element into a string. These elements will be displayed in a listview in the Console.

def LogAssert( self, condition: bool = None, title: str = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs an assert message if a condition is false with a log level of SILevel.Error.

Arguments:
  • condition (bool): The condition to check.
  • title (str): The title of the Log Entry.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

An assert message is logged if this method is called with a condition parameter of the value false. No Log Entry is generated if this method is called with a condition parameter of the value true.

A typical usage of this method would be to test if a variable is not set to null before you use it. To do this, you just need to insert a LogAssert call to the code section in question with "instance != null" as first parameter. If the reference is null and thus the expression evaluates to false, a message is logged.

def LogAssigned( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value: object = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs whether a variable is assigned or not with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The name of the variable.
  • value (object): The variable value which should be checked for null.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

If the value argument is null, then ": Not assigned", otherwise ": Assigned" will be appended to the name before the Log Entry is sent.

This method is useful to check source code for null references in places where you experienced or expect problems and want to log possible null references.

def LogBinary( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, buffer: bytes = None, offset: int = None, count: int = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a byte array with a custom log level and displays it in a hex viewer.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • buffer (bytes): The byte array to display in the hex viewer.
  • offset (int): The byte offset (zero-based) of buffer at which to display data from.
  • count (int): The amount of bytes to display.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
def LogBinaryFile( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, fileName: str = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a binary file and displays its content in a hex viewer using a custom title and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • fileName (str): The binary file to display in a hex viewer.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
def LogBinaryStream( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, stream: _io.BufferedReader = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a binary stream with a custom log level and displays its content in a hex viewer.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • stream (BufferedReader): The binary stream to display in a hex viewer.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
def LogBitmapFile( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, fileName: str = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a bitmap file and displays it in the Console using a custom title and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • fileName (str): The bitmap file to display in the Console.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
def LogBitmapStream( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, stream: _io.BufferedReader = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a stream with a custom log level and interprets its content as a bitmap.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • stream (BufferedReader): The stream to display as bitmap.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
def LogBool( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value: bool = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a bool value with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The variable name.
  • value (bool): The variable value.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs the name and value of a boolean variable. A title like "name = True" will be displayed in the Console.

def LogByte( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value: int = None, includeHex: bool = False, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a byte value with an optional hexadecimal representation and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The variable name.
  • value (int): The variable value.
  • includeHex (bool): Indicates if a hexadecimal representation should be included (True) or not (False).
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs the name and value of a single byte variable. A title like "name = 10" will be displayed in the Console.

def LogChar( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value: <built-in function chr> = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a chr value with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The variable name.
  • value (chr): The variable value.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs the name and value of a chr variable. A title like "name = 'c'" will be displayed in the Console.

def LogCollection( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, oColl: Collection = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs the content of a collection with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console; "Current stack trace" is used if one is not supplied.
  • oColl (Collection): The collection to log.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method iterates through the supplied collection and calls SIObjectRenderer.RenderObject to render every value into a string. These values will be displayed in a listview in the Console.

def LogColored( self, level: smartinspectpython.silevel.SILevel = None, colorValue: smartinspectpython.sicolor.SIColors = None, title: str = None) -> None:

Logs a colored message with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
  • title (str): The message to log.
def LogComplex( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value: complex = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a complex value with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The variable name.
  • value (float): The variable value.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs the name and value of a complex variable. A title like "name = 3.14159" will be displayed in the Console.

def LogConditional( self, level: smartinspectpython.silevel.SILevel = None, condition: bool = None, title: str = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a conditional message with a custom log level. The message is created with a format string and a related array of arguments.

Arguments:
  • level (SILevel): The log level of this method call.
  • condition (bool): The condition to evaluate.
  • title (str): The title of the conditional message.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method only sends a message if the passed 'condition' argument evaluates to true. If 'condition' is false, this method has no effect and nothing is logged. This method is thus the counter piece to LogAssert.

This version of the method accepts a format string and a related array of arguments. These parameters will be passed to the String.Format method and the resulting string will be the conditional message.

def LogCurrentAppDomain( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs information about the current application and its setup with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs information about the current application and its setup. This is not quite the same as the C# equivalent, but it does log similar properties.

def LogCurrentStackTrace( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, limit: int = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs the current stack trace with a custom title and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console; "Current stack trace" is used if one is not supplied.
  • limit (int): The number of frames to print (specify None to print all remaining frames).
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs the current stack trace. The resulting Log Entry contains all methods including the related classes that are currently on the stack. Furthermore, the filename, line and columns numbers are included.

Please note that the stack frame information results will NOT include 2 frames that are used by the SmartInspect API to process the frame data.

def LogCurrentThread( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs information about the current thread with a custom title and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs information about the current thread. This includes its name, its current state and more.

LogCurrentThread is especially useful in a multi-threaded program like in a network server application. By using this method you can easily track all threads of a process and obtain detailed information about them.

See LogThread for a more general method which can handle any thread. public void LogCurrentThread(Level level, string title)

def LogCustomContext( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, lt: smartinspectpython.silogentrytype.SILogEntryType = None, ctx: smartinspectpython.siviewercontext.SIViewerContext = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a custom viewer context with a custom log level. viewer ID and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • lt (SILogEntryType): The custom Log Entry type.
  • ctx (SIViewerContext): The viewer context which holds the actual data and the appropriate viewer ID.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
def LogCustomFile( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, fileName: str = None, lt: smartinspectpython.silogentrytype.SILogEntryType = None, vi: smartinspectpython.siviewerid.SIViewerId = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs the content of a file using a custom Log Entry type, viewer ID and title and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • fileName (str): The file to log.
  • lt (SILogEntryType) The custom Log Entry type.
  • vi (SIViewerId): The custom viewer ID which specifies the way the Console handles the file content.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs the content of the supplied file using a custom Log Entry type and viewer ID. The parameters control the way the content of the file is displayed in the Console. Thus you can extend the functionality of the SmartInspect library with this method.

def LogCustomReader( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, reader: _io.TextIOWrapper = None, lt: smartinspectpython.silogentrytype.SILogEntryType = None, vi: smartinspectpython.siviewerid.SIViewerId = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs the content of a text reader using a custom Log Entry type and viewer ID and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • reader (TextIOWrapper): The text reader to log.
  • lt (SILogEntryType): The custom Log Entry type.
  • vi (SIViewerId): The custom viewer ID which specifies the way the Console handles the reader content.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs the content of the supplied reader using custom Log Entry type and viewer ID. The parameters control the way the content of the reader is displayed in the Console. Thus you can extend the functionality of the SmartInspect library with this method.

def LogCustomStream( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, stream: _io.BufferedReader = None, lt: smartinspectpython.silogentrytype.SILogEntryType = None, vi: smartinspectpython.siviewerid.SIViewerId = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs the content of a stream using a custom Log Entry type and viewer ID and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • stream (BufferedReader): The stream to log (BufferedReader).
  • lt (SILogEntryType): The custom Log Entry type.
  • vi (SIViewerId): The custom viewer ID which specifies the way the Console handles the stream content.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs the content of the supplied stream using a custom Log Entry type and viewer ID. The parameters control the way the content of the stream is displayed in the Console. Thus you can extend the functionality of the SmartInspect Python library with this method.

def LogCustomText( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, text: str = None, lt: smartinspectpython.silogentrytype.SILogEntryType = None, vi: smartinspectpython.siviewerid.SIViewerId = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs custom text using a custom Log Entry type and viewer ID and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • text (str): The text to log.
  • lt (SILogEntryType): The custom Log Entry type.
  • vi (SIViewerId): The custom viewer ID which specifies the way the Console handles the text content.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
def LogDateTime( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value: <module 'datetime' from 'C:\\Program Files\\Python39\\lib\\datetime.py'> = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a datetime value with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The variable name.
  • value (str): The variable value.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs the name and value of a datetime variable. A title like "name = 05/15/2023 02:15:30 PM" will be displayed in the Console.

def LogDebug( self, title: str, *args, colorValue: smartinspectpython.sicolor.SIColors = None, logToSystemLogger: bool = True) -> None:

Logs a debug message with a log level of SILevel.Debug.

Arguments:
  • title (str): The message to log.
  • *args: Format arguments for the title argument.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method will also log a message to the system log if the SystemLogger property is set.

def LogDictionary( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, oDict: dict = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs the content of a dictionary with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console; "Current stack trace" is used if one is not supplied.
  • oDict (dict): The dictionary to log.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method iterates through the supplied dictionary and calls SIObjectRenderer.RenderObject to render every key/value pair into a string. These pairs will be displayed in a key/value viewer in the Console.

def LogEnumerable( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, oList: list = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs the content of a list with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console; "Current stack trace" is used if one is not supplied.
  • oList (list): The list to log.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method iterates through the supplied list and calls SIObjectRenderer.RenderObject to render every element into a string. These elements will be displayed in a listview in the Console.

def LogError( self, title: str, *args, colorValue: smartinspectpython.sicolor.SIColors = None, logToSystemLogger: bool = True) -> None:

Logs a error message with a log level of SILevel.Error.

Arguments:
  • title (str): The message to log.
  • *args: Format arguments for the title argument.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
  • logToSystemLogger (bool): True to log the exception to the SystemLogger instance (if one was supplied);
    otherwise, False to not log the exception to the SystemLogger instance.
    Default is True.

This method will also log a message to the system log if the SystemLogger property is set.

def LogException( self, title: str = None, ex: Exception = None, colorValue: smartinspectpython.sicolor.SIColors = None, logToSystemLogger: bool = True):

Logs the content of an exception with a custom title and a log level of SILevel.Error.

Arguments:
  • title (str): The title to display in the Console.
  • ex (Exception): The exception to log.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
  • logToSystemLogger (bool): True to log the exception to the SystemLogger instance (if one was supplied);
    otherwise, False to not log the exception to the SystemLogger instance.
    Default is True.

This method extracts the exception message and stack trace from the supplied exception and logs an error with this data. It is especially useful if you place calls to this method in exception handlers. See LogError for a more general method with a similar intention.

This method will also automatically log the exception to the system log if the SystemLogger property is set and the logToSystemLogger argument is True.

Sample Code

# package imports.
from smartinspectpython.siauto import *

# get smartinspect logger reference.
_logsi:SISession = SIAuto.Main

try:

    _logsi.LogMessage("Forcing a divide by zero error ...")
    1/0   # force an exception
    _logsi.LogMessage("You should not see this message due to the above exception.")

except Exception as ex:

    # log exceptions.
    _logsi.LogException("*** Caught exception!", ex)
    _logsi.LogException(None, ex)

def LogFatal( self, title: str, *args, colorValue: smartinspectpython.sicolor.SIColors = None, logToSystemLogger: bool = True) -> None:

Logs a fatal error message with a log level of SILevel.Fatal.

Arguments:
  • title (str): The message to log.
  • *args: Format arguments for the title argument.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
  • logToSystemLogger (bool): True to log the exception to the SystemLogger instance (if one was supplied);
    otherwise, False to not log the exception to the SystemLogger instance.
    Default is True.

This method is ideally used in error handling code such as exception handlers. If this method is used consequently, it is easy to troubleshoot and solve bugs in applications or configurations. See LogError for a method which does not describe fatal but recoverable errors.

This method will also log a message to the system log if the SystemLogger property is set.

Sample Code

# package imports.
from smartinspectpython.siauto import *

# get smartinspect logger reference.
_logsi:SISession = SIAuto.Main

# log messsages.
_logsi.LogFatal("This is a fatal error message in regular background color.")
_logsi.LogFatal("This is a fatal error message in RED background color.", SIColors.Red)

def LogFloat( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value: float = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a float value with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The variable name.
  • value (float): The variable value.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs the name and value of a float variable. A title like "name = 3.14159" will be displayed in the Console.

def LogHtml( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, html: str = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs HTML code with a custom log level and displays it in a web browser.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • html (str): The HTML source code to display.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs the supplied HTML source code. The source code is displayed as a website in the web viewer of the Console.

def LogHtmlFile( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, fileName: str = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs an HTML file and displays the content in a web browser using a custom title and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • fileName (str): The HTML file to display.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs the HTML source code of the supplied file. The source code is displayed as a website in the web viewer of the Console.

def LogHtmlReader( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, reader: _io.TextIOWrapper = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a text reader with a custom log level and displays the content in a web browser.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • reader (TextIOWrapper): The text reader to display (TextReader).
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs the HTML source code of the supplied reader. The source code is displayed as a website in the web viewer of the Console.

def LogHtmlStream( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, stream: _io.BufferedReader = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a stream with a custom log level and displays the content in a web browser.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • stream (BufferedReader): The stream to display.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs the HTML source code of the supplied stream. The source code is displayed as a website in the web viewer of the Console.

def LogIconFile( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, fileName: str = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a Windows icon file and displays it in the Console using a custom title and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • fileName (str): The Windows icon file to display in the Console.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
def LogIconStream( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, stream: _io.BufferedReader = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a stream with a custom log level and interprets its content as Windows icon.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • stream (BufferedReader): The stream to display as Windows icon.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
def LogInt( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value: int = None, includeHex: bool = False, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs an integer value with an optional hexadecimal representation and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The variable name.
  • value (int): The variable value.
  • includeHex (bool): Indicates if a hexadecimal representation should be included (True) or not (False).
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs the name and value of a integer variable. A title like "name = 10" will be displayed in the Console.

def LogInternalError( self, title: str, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs an internal error with a log level of SILevel.Error.

Arguments:
  • title (str): A string which describes the internal error.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs an internal error. Such errors can occur if session methods are invoked with invalid arguments. For example, if you pass an invalid format string to LogMessage, the exception will be caught and an internal error with the exception message will be sent.

This method is also intended to be used in derived classes to report any errors in your own methods.

def LogJpegFile( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, fileName: str = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a JPEG file and displays it in the Console using a custom title and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • fileName (str): The JPEG file to display in the Console.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
def LogJpegStream( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, stream: _io.BufferedReader = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a stream with a custom log level and interprets its content as JPEG image.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • stream (BuffereReader): The stream to display as JPEG image.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
def LogMessage( self, title: str, *args, colorValue: smartinspectpython.sicolor.SIColors = None, logToSystemLogger: bool = True) -> None:

Logs a message with a log level of SILevel.Message.

Arguments:
  • title (str): The message to log.
  • *args: Format arguments for the title argument.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
  • logToSystemLogger (bool): True to log the exception to the SystemLogger instance (if one was supplied);
    otherwise, False to not log the exception to the SystemLogger instance.
    Default is True.

This method will also log a message to the system log if the SystemLogger property is set.

def LogMetafileFile( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, fileName: str = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a Windows Metafile file and displays it in the Console using a custom title and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • fileName (str): The Windows Metafile file to display in the Console.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
def LogMetafileStream( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, stream: _io.BufferedReader = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a stream with a custom log level and interprets its content as Windows Metafile image.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • stream (BufferedReader): The stream to display as Windows Metafile image.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
def LogObject( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, instance: object = None, excludeNonPublic: bool = False, excludeBuiltIn: bool = True, excludeFunctions: bool = True, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs fields and properties of an object with a custom log level. Lets you specify if non public members should also be logged.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • instance (object): The object whose fields and properties should be logged.
  • excludeNonPublic (bool): Specifies if non public member items (e.g. "_x" prefix) should be excluded from the log data.
  • excludeBuiltIn (bool): Specifies if non public "built-in" member items (e.g. "__x" prefix) should be excluded from the log data.
  • excludeFunctions (bool): Specifies if routine, function, and method data is included in the log data.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs all field and property names and their current values of an object. These key/value pairs will be displayed in the Console in an object inspector like viewer.

You can specify if non public or only public members should be logged by setting the excludeNonPublic argument to true or false, respectively.

def LogObjectValue( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value: object = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a object value with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The variable name.
  • value (object): The variable value.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs the name and value of a object variable. A title like "name = My Object" will be displayed in the Console. If the value is null, then a title like "name = null" will be displayed in the Console.

def LogPngFile( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, fileName: str = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a PNG file and displays it in the Console using a custom title and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • fileName (str): The PNG file to display in the Console.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

Note that this method is only supported in the SI Console Viewer v3.4+. Previous versions of the Si Console will display "A viewer for the selected Log Entry could not be found" error.

def LogPngStream( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, stream: _io.BufferedReader = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a stream with a custom log level and interprets its content as PNG image.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • stream (BuffereReader): The stream to display as PNG image.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

Note that this method is only supported in the SI Console Viewer v3.4+. Previous versions of the Si Console will display "A viewer for the selected Log Entry could not be found" error.

def LogReader( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, reader: _io.TextIOWrapper = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a reader with a custom log level and displays the content in a read-only text field.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • reader (TextIOWrapper): The text reader to log.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
def LogSeparator( self, level: smartinspectpython.silevel.SILevel = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a simple separator with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method instructs the Console to draw a separator. A separator is intended to group related Log Entry and to separate them visually from others. This method can help organizing Log Entries in the Console.

def LogSource( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, source: str = None, id: smartinspectpython.sisourceid.SISourceId = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs source code that is displayed with syntax highlighting in the Console using a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • source (str): The source code to log.
  • id (SISourceId): Specifies the type of source code.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method displays the supplied source code with syntax highlighting in the Console. The type of the source code can be specified by the 'id' argument. Please see the SISourceId enum for information on the supported source code types.

def LogSourceFile( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, fileName: str = None, id: smartinspectpython.sisourceid.SISourceId = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs the content of a file as source code with syntax highlighting using a custom title and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • fileName (str): The name of the file which contains the source code.
  • id (SISourceId): Specifies the type of source code.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method displays the source file with syntax highlighting in the Console. The type of the source code can be specified by the 'id' argument. Please see the SISourceId enum for information on the supported source code types.

def LogSourceReader( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, reader: _io.TextIOWrapper = None, id: smartinspectpython.sisourceid.SISourceId = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs the content of a text reader as source code with syntax highlighting using a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • reader (TextIOWrapper): The text reader which contains the source code.
  • id (SISourceId): Specifies the type of source code.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method displays the content of a reader with syntax highlighting in the Console. The type of the source code can be specified by the 'id' argument. Please see the SISourceId enum for information on the supported source code types.

def LogSourceStream( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, stream: _io.BufferedReader = None, id: smartinspectpython.sisourceid.SISourceId = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs the content of a stream as source code with syntax highlighting using a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • stream (BufferedReader): The stream which contains the source code.
  • id (SISourceId): Specifies the type of source code.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method displays the content of a stream with syntax highlighting in the Console. The type of the source code can be specified by the 'id' argument. Please see the SISourceId enum for information on the supported source code types.

def LogSql( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, source: str = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a string containing SQL source code with a custom log level. The SQL source code is displayed with syntax highlighting in the Console.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • source (str): The SQL source code to log.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method displays the supplied SQL source code with syntax highlighting in the Console.

It is especially useful to debug or track dynamically generated SQL source code.

def LogSqliteDbCursorData( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, cursor: sqlite3.Cursor = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs the contents of a Sqlite Cursor with a custom title and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • cursor (Cursor): The cursor data to log.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs all data of the supplied cursor, using a "for row in cursor:" statement. Note that this WILL move the position of the cursor, and the position is not restored.

def LogSqliteDbSchemaCursor( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, cursor: sqlite3.Cursor = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs the schema of a Sqlite Cursor with a custom title and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • cursor (Cursor): The cursor schema to log.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs the schema of the supplied cursor, by querying its "description" property value.
It does not move the position of the cursor.

A cursor schema contains the name of every column in the cursor. Note that this data could be different than what is actually defined in the database table that the schema is derived from, as the SELECT statement used to query the database could limit the columns returned.

def LogSqliteDbSchemaForeignKeyList( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, conn: sqlite3.Connection = None, tableName: str = None, sortByName: bool = False, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs the schema of a Sqlite DB Table Foreign Key List with a custom title and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • conn (Connection): Sqlite database connection object.
  • tableName (str): The name of the table to obtain schema information for.
  • sortByName (bool): Sorts the log data by Table Name (True) or by ID (False, default).
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method queries the schema information by executing the following SQL statement: "SELECT * FROM pragma_foreign_key_list('');"

This will log the following details returned from the schema information query: ID, Sequence, Table, From, To, On Update, On Delete, Match

def LogSqliteDbSchemaIndexList( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, conn: sqlite3.Connection = None, tableName: str = None, sortByName: bool = False, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs the schema of a Sqlite DB Table Index List with a custom title and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • conn (Connection): Sqlite database connection object.
  • tableName (str): The name of the table to obtain schema information for.
  • sortByName (bool): Sorts the log data by Index Name (True) or by ID (False, default).
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method queries the schema information by executing the following SQL statement: "SELECT * FROM pragma_index_list('');"

This will log the following details returned from the schema information query: Sequence, Name, Unique, Origin, Partial

def LogSqliteDbSchemaTableInfo( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, conn: sqlite3.Connection = None, tableName: str = None, sortByName: bool = False, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs the schema of a Sqlite DB Table with a custom title and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • conn (Connection): Sqlite database connection object.
  • tableName (str): The name of the table to obtain schema information for.
  • sortByName (bool): Sorts the log data by Table Name (True) or by ID (False, default).
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method queries the schema information by executing the following SQL statement: "SELECT * FROM pragma_table_info('');"

This will log the following details returned from the schema information query:

  • id, name, data type, not null, default value, primary key, hidden column.
def LogSqliteDbSchemaTables( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, conn: sqlite3.Connection = None, sortByName: bool = False, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs the schema table names defined in a Sqlite DB with a custom title and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • conn (Connection): Sqlite database connection object.
  • sortByName (bool): Sorts the log data by Table Name (True) or by entry order (False, default).
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method queries the schema information by executing the following SQL statement: "SELECT * FROM sqlite_schema WHERE type ='table';"

This will log the following details returned from the schema information query:

  • type, name, tbl_name, rootpage, sql
def LogStackTrace( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, strace: list[inspect.FrameInfo] = None, startFrame: int = 0, limit: int = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a stack trace with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • strace (object): StackTrace instance to log.
  • startFrame (int): The offset of the first frame preceding the caller to print (default 0).
  • limit (int): The number of frames to print (specify None to print all remaining frames).
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs the supplied stack trace. The resulting Log Entry contains all methods including the related classes lists. Furthermore the filename, line and columns numbers are included.

def LogStream( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, stream: _io.BufferedReader = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a stream with a custom log level and displays the content in a read-only text field.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • stream (BufferedStream): The stream to log.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
def LogString( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value: str = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a string value with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The variable name.
  • value (str): The variable value.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs the name and value of a string variable. A title like "name = "Value"" will be displayed in the Console.

def LogSystem( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs information about the system using a custom title and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

The logged information include the version of the operating system, the Python version and more. This method is useful for logging general information at the program startup. This guarantees that the support staff or developers have general information about the execution environment.

def LogText( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, text: str = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a string with a custom log level and displays it in a read-only text field.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • text (str): The text to log.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
def LogTextFile( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, fileName: str = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a text file and displays the content in a read-only text field using a custom title and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • fileName (str): The file to log.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
def LogTextReader( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, reader: _io.TextIOWrapper = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a text reader with a custom log level and displays the content in a read-only text field.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • reader (TextIOWrapper): The text reader to log.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
def LogTextStream( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, stream: _io.BufferedReader = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs a stream with a custom log level and displays the content in a read-only text field.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • stream (BufferedStream): The stream to log.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
def LogThread( self, level: smartinspectpython.silevel.SILevel = None, title: str = None, thread: threading.Thread = None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs information about a thread with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title to display in the Console.
  • thread (Thread): The thread to log.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method logs information about the supplied thread. This includes its name, its current state and more.

LogThread is especially useful in a multi-threaded program like in a network server application. By using this method you can easily track all threads of a process and obtain detailed information about them.

def LogValue( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value=None, colorValue: smartinspectpython.sicolor.SIColors = None) -> None:

Logs the name and value of a variable with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The variable name.
  • value (object): The variable value.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.

This method just calls the appropriate "LogX" method (e.g. LogString, LogInt, etc) based upon the type of value as determined by isinstance. Note that it is faster to call the "LogX" method directly - this method is provided for C# SI compatibility.

def LogVerbose( self, title: str, *args, colorValue: smartinspectpython.sicolor.SIColors = None, logToSystemLogger: bool = True) -> None:

Logs a verbose message with a log level of SILevel.Verbose.

Arguments:
  • title (str): The message to log.
  • *args: Format arguments for the title argument.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
  • logToSystemLogger (bool): True to log the exception to the SystemLogger instance (if one was supplied);
    otherwise, False to not log the exception to the SystemLogger instance.
    Default is True.

This method will also log a message to the system log if the SystemLogger property is set.

def LogWarning( self, title: str, *args, colorValue: smartinspectpython.sicolor.SIColors = None, logToSystemLogger: bool = True) -> None:

Logs a warning message with a log level of SILevel.Warning.

Arguments:
  • title (str): The message to log.
  • *args: Format arguments for the title argument.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
  • logToSystemLogger (bool): True to log the exception to the SystemLogger instance (if one was supplied);
    otherwise, False to not log the exception to the SystemLogger instance.
    Default is True.

This method will also log a message to the system log if the SystemLogger property is set.

def ResetCallstack(self, level: smartinspectpython.silevel.SILevel = None) -> None:

Resets the call stack by using a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.

This method instructs the Console to reset the call stack generated by the EnterMethod and LeaveMethod methods. It is especially useful if you want to reset the indentation in the method hierarchy without clearing all log entries.

def ResetCheckpoint(self, name: str = None) -> None:

Resets a named checkpoint counter.

Arguments:
  • name (str): The name of the checkpoint to reset.

This method resets the counter of the given named checkpoint. Named checkpoints can be incremented and logged with the AddCheckpoint method.

def ResetColor(self) -> None:

Resets the session background color to its default value.

The default background color of a session is white transparent.

def ResetCounter(self, name: str = None) -> None:

Resets a named counter to its initial value of 0.

Arguments:
  • name (str): The name of the counter to reset.

This method resets the integer value of a named counter to 0 again. If the supplied counter is unknown, this method has no effect. Please refer to the IncCounter and DecCounter methods for more information about named counters.

def SendCustomControlCommand( self, level: smartinspectpython.silevel.SILevel, ct: smartinspectpython.sicontrolcommandtype.SIControlCommandType, data: _io.BytesIO = None) -> None:

Logs a custom Control Command with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • ct (SIControlCommandType): The Control Command type to use.
  • data (BytesIO): Optional data stream which can be null.
def SendCustomLogEntry( self, level: smartinspectpython.silevel.SILevel, title: str, lt: smartinspectpython.silogentrytype.SILogEntryType, vi: smartinspectpython.siviewerid.SIViewerId, colorValue: smartinspectpython.sicolor.SIColors = None, data: _io.BytesIO = None) -> None:

Logs a custom Log Entry with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title of the new Log Entry.
  • lt (SILogEntryType): The Log Entry type to use.
  • vi (SIViewerId): The Viewer ID to use.
  • colorValue (SIColors): Background color value (SIColors enum, or ARGB integer form) for the message. Refer to the SIColors enum in the sicolor module for common color values. Specify None to use default background color.
  • data Optional data stream which can be null (or None).

This method is useful for implementing custom Log Entry methods. For example, if you want to display some information in a particular way in the Console, you can just create a simple method which formats the data in question correctly and logs them using this SendCustomLogEntry method.

def SendCustomProcessFlow( self, level: smartinspectpython.silevel.SILevel, title: str, pt: smartinspectpython.siprocessflowtype.SIProcessFlowType) -> None:

Logs a custom Process Flow entry with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • title (str): The title of the new Process Flow entry.
  • pt (SIProcessFlowType): The Process Flow type to use.
def SendCustomWatch( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value=None, watchType: smartinspectpython.siwatchtype.SIWatchType = None) -> None:

Logs a custom Watch with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The name of the Watch.
  • value (object): The value of the Watch.
  • watchType (SIWatchType): The Watch type to use

This method is useful for implementing custom Watch methods. For example, if you want to track the status of an instance of a specific class, you can just create a simple method which extracts all necessary information about this instance and logs them using this SendCustomWatch method.

def Watch( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value=None, watchType: smartinspectpython.siwatchtype.SIWatchType = None) -> None:

Logs a Watch value by using the specified (or default) log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The name of the Watch.
  • value: The bool value to display as Watch value.
  • watchType (SIWatchType): WatchType to set in the Log Entry.

"null" will be displayed if value=None.

This method uses the SmartInspect.DefaultLevel value if the level parameter is set to None (default). Otherwise, the specified level is utilized.

def WatchBool( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value: bool = False) -> None:

Logs a boolean Watch with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The name of the Watch.
  • value (bool): The bool value to display as Watch value.

This method uses the SmartInspect.DefaultLevel value if the level parameter is set to None (default). Otherwise, the specified level is utilized.

def WatchByte( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value: int = 0, includeHex: bool = False) -> None:

Logs a byte Watch with an optional hexadecimal representation and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The name of the Watch.
  • value (int): The byte value to display as Watch value.
  • includeHex (bool): Indicates if a hexadecimal representation should be included.

This method logs a byte Watch. You can specify if a hexadecimal representation should be included as well by setting the includeHex parameter to true.

This method uses the SmartInspect.DefaultLevel value if the level parameter is set to None (default). Otherwise, the specified level is utilized.

def WatchChar( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value: <built-in function chr> = 0) -> None:

Logs a chr Watch with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The name of the Watch.
  • value (chr): The chr value to display as Watch value.

This method uses the SmartInspect.DefaultLevel value if the level parameter is set to None (default). Otherwise, the specified level is utilized.

def WatchComplex( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value: complex = None) -> None:

Logs a complex Watch with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The name of the Watch.
  • value (complex): The complex value to display as Watch value.

This method uses the SmartInspect.DefaultLevel value if the level parameter is set to None (default). Otherwise, the specified level is utilized.

def WatchDateTime( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value: <module 'datetime' from 'C:\\Program Files\\Python39\\lib\\datetime.py'> = None) -> None:

Logs a datetime Watch with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The name of the Watch.
  • value (datetime) The datetime value to display as Watch value.

This method uses the SmartInspect.DefaultLevel value if the level parameter is set to None (default). Otherwise, the specified level is utilized.

def WatchFloat( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value: float = 0) -> None:

Logs a float Watch with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The name of the Watch.
  • value (float): The float value to display as Watch value.

This method uses the SmartInspect.DefaultLevel value if the level parameter is set to None (default). Otherwise, the specified level is utilized.

def WatchInt( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value: int = 0, includeHex: bool = False) -> None:

Logs an integer Watch with an optional hexadecimal representation and custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The name of the Watch.
  • value (int): The integer value to display as Watch value.
  • includeHex (bool): Indicates if a hexadecimal representation should be included.

This method logs a integer Watch. You can specify if a hexadecimal representation should be included as well by setting the includeHex parameter to true.

This method uses the SmartInspect.DefaultLevel value if the level parameter is set to None (default). Otherwise, the specified level is utilized.

def WatchObject( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value: object = None) -> None:

Logs an object Watch with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The name of the Watch.
  • value (object): The object value to display as Watch value.

The value of the resulting Watch is the return value of the "str(value)" method of the supplied object.

This method uses the SmartInspect.DefaultLevel value if the level parameter is set to None (default). Otherwise, the specified level is utilized.

def WatchString( self, level: smartinspectpython.silevel.SILevel = None, name: str = None, value: str = None) -> None:

Logs a string Watch with a custom log level.

Arguments:
  • level (SILevel): The log level of this method call.
  • name (str): The name of the Watch.
  • value (str): The string value to display as Watch value.

This method uses the SmartInspect.DefaultLevel value if the level parameter is set to None (default). Otherwise, the specified level is utilized.