Integrating and using the logging library

Adding SmartInspect logging to your application takes just a few lines
of code. Get rich logging data web application, service or enterprise system.

The SmartInspect libraries provide you with many different log methods to log messages, warnings, exceptions, files, images and even entire objects. All libraries share the same core set of features and contain additional functionality for the particular development environment. Their power and flexibility ensure that all your logging needs are fully met.

// Log simple messages, warnings and exceptions
SiAuto.Main.LogMessage("Processing Order 48843");
SiAuto.Main.LogWarning("Connection refused while trying to connect!");
SiAuto.Main.LogException(e);

// Generate call stack information
SiAuto.Main.EnterMethod(this, "Button1_Click");
SiAuto.Main.LeaveMethod(this, "Button1_Click");

// Log variable value, datasets or any other object
SiAuto.Main.LogInt("index", index);
SiAuto.Main.LogObject("order", order);
SiAuto.Main.LogDataSet("dataSet", dataSet);
' Log simple messages, warnings and exceptions
SiAuto.Main.LogMessage("Processing Order 48843")
SiAuto.Main.LogWarning("Connection refused while trying to connect!")
SiAuto.Main.LogException(e)

' Generate call stack information
SiAuto.Main.EnterMethod(Me, "Button1_Click")
SiAuto.Main.LeaveMethod(Me, "Button1_Click")

' Log variable value, datasets or any other object
SiAuto.Main.LogInt("index", index)
SiAuto.Main.LogObject("order", order)
SiAuto.Main.LogDataSet("dataSet", dataSet)
// Log simple messages, warnings and exceptions
SiAuto.main.logMessage("Processing Order 48843");
SiAuto.main.logWarning("Connection refused while trying to connect!");
SiAuto.main.logException(e);

// Generate call stack information
SiAuto.main.enterMethod(this, "Button1_Click");
SiAuto.main.leaveMethod(this, "Button1_Click");

// Log variable value, result sets or any other object
SiAuto.main.logInt("index", index);
SiAuto.main.logObject("order", order);
SiAuto.main.logResultSet("resultSet", resultSet);
{ Log simple messages, warnings and exceptions }
SiMain.LogMessage('Processing Order 48843');
SiMain.LogWarning('Connection refused while trying to connect!');
SiMain.LogException(E);

{ Generate call stack information }
SiMain.EnterMethod(Self, 'Button1_Click');
SiMain.LeaveMethod(Self, 'Button1_Click');

{ Log variable value, datasets or any other object }
SiMain.LogInteger('Index', Index);
SiMain.LogObject('Order', Order);
SiMain.LogDataSet('DataSet', DataSet);

Specialized Viewers

The specialized Viewers help you to view and analyze your data. Besides being responsible for displaying the logged information, they provide additional functionality to copy, save and export your data. The set of available viewers ranges from simple text viewers, over an object inspector to more complex viewers like a hex and even a table viewer.

SmartInspect Viewers
  1. The Text viewer displays your log entry titles and any attached texts. It displays the line count, supports word wrapping and can save the logged information to a file.
  2. Entire objects can be analyzed with the Inspector viewer. Depending on the used SmartInspect library, it displays fields, properties and even events of any arbitrary object.
  3. To inspect binary data, the Binary viewer assists you with a powerful hex editor interface. This can be very useful to analyze binary files and memory dumps.
  4. The Source viewer lets you inspect any kind of source code with built-in syntax highlighting for several source code types like scripting languages, SQL code and XML.

Protocols and Options

The different protocols like the built-in file, TCP and named pipe protocols allow you to log to different destinations. You can have multiple logging connections open at the same time and log to a file and the Console simultaneously. You can customize the behavior of any protocol by specifying additional protocol options in the connections string.

// Append your data to a file named "c:\log.sil"
SiAuto.Si.Connections = "file(filename=c:\log.sil, append=true)";

// Send your log data directly to the Console via TCP
SiAuto.Si.Connections = "tcp(host=localhost, timeout=10000)";
' Append your data to a file named "c:\log.sil"
SiAuto.Si.Connections = "file(filename=c:\log.sil, append=true)"

' Send your log data directly to the Console via TCP
SiAuto.Si.Connections = "tcp(host=localhost, timeout=10000)"
// Append your data to a file named "c:\log.sil"
SiAuto.Si.setConnections("file(filename=c:\log.sil, append=true)");

// Send your log data directly to the Console via TCP
SiAuto.Si.setConnections("tcp(host=localhost, timeout=10000)");
{ Append your data to a file named "c:\log.sil" }
Si.Connections := 'file(filename=c:\log.sil, append=true)';

{ Send your log data directly to the Console via TCP }
Si.Connections := 'tcp(host=localhost, timeout=10000)';

Navigation in the Console

To quickly navigate through log entries, the SmartInspect Console contains many useful navigation features. You can jump to the start and end of a method, jump to log entries of a selected type and set bookmarks on important log entries.

SmartInspect further contains strong search capabilities to quickly find the information you are looking for. Besides the standard search functionality, regular expressions let you specify even complex search terms easily.

SmartInspect Navigation
  1. Simply select a log entry type and jump to all occurrences in the current view. Additional commands let you jump to the start and end of a method and explore the call stack of a log entry.
  2. Quickly jump to relevant methods with the Go to Method dialog. Just enter a few characters of the method name and select the method to jump to its position in the current log.
  3. Bookmark one or more log entries per view to quickly jump back and forth between important sections of your log.