smartinspectpython.siauto

Module: siauto.py

Revision History

Date Version Description
2023/05/30 3.0.0.0 Initial Version.

Provides automatically created objects for using SmartInspect Python logging.

The following classes are imported when from smartinspectpython.siauto import * is specified:

  • SIArgumentNullException
  • SIArgumentOutOfRangeException
  • SIAuto
  • SIColors
  • SIConfigurationTimer
  • SIControlCommandEventArgs
  • SIErrorEventArgs
  • SIFilterEventArgs
  • SIInfoEventArgs
  • SILevel
  • SILogEntryEventArgs
  • SIProcessFlowEventArgs
  • SISession
  • SIWatchEventArgs
  • SmartInspectException
@static_init
class SIAuto:

Provides automatically created objects for using the SmartInspect and SISession classes.

This class provides a static property called Si of type SmartInspect. Furthermore a SISession instance named Main with Si as parent is ready to use. The siauto module is especially useful if you do not want to create SmartInspect and SISession instances by yourself.

The SmartInspect.Connections property of Si is set to "tcp(host=localhost)", the SmartInspect.AppName property to "Auto" and the SISession.Name property to "Main".

Threadsafety:

The public static members of this class are thread-safe.

Example:

# Use the following for 1-time initialization code:

from .smartinspectpython.siauto import *
SIAuto.Si.Connections = 'tcp(host=yourdns.com)'
SIAuto.Si.Enabled = True               # connect
SIAuto.Main.Level = SILevel.Debug      # set logging level to Debug (ALL msgs)
#SIAuto.Main.Level = SILevel.Verbose   # set logging level to Verbose
#SIAuto.Main.Level = SILevel.Message   # set logging level to Message
#SIAuto.Main.Level = SILevel.Warning   # set logging level to Warning
#SIAuto.Main.Level = SILevel.Error     # set logging level to Error

# Use the following in main (or classes) in your project:

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

# log some messages and data.
_logsi.LogSystem(SILevel.Debug)
_logsi.LogDebug("This is a Debug message.")
_logsi.LogMessage("This is a Message.")
_logsi.LogWarning("You have been warned!")
_logsi.LogError("Danger Will Robinson!")

SmartInspect logging instance (automatically created).

SmartInspect logging Session instance ('Main', automatically created).

The SISession.Name is set to "Main" and the SISession.Parent to SIAuto.Si.

Example:

# Use the following in main (or classes) in your project:

# get logger reference.
from .smartinspectpython.siauto import *
_logsi:SISession = SIAuto.Main

# log some messages and data.
_logsi.LogSystem(SILevel.Debug)
_logsi.LogDebug("This is a Debug message.")
_logsi.LogMessage("This is a Message.")
_logsi.LogWarning("You have been warned!")
_logsi.LogError("Danger Will Robinson!")
@classmethod
def static_init(cls) -> None:

Initializes a new static instance of the class.