Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

Logging level does not seem to work



Not sure if I am doing this right but when I attempt to assign a Logtext with a value of lvDebug, it does not seem to show up correctly in the console.

This is my code base

  Si := TSmartInspect.Create('Objects');
  Si.Connections := 'tcp()';
  si.AppName := 'MyApp';
  Si.Enabled := True;
  si.DefaultLevel := lvVerbose;

// Create the sessions and set colors
SiTestUnit := Si.AddSession(Session1);
SiTestUnit.Color := clBlue;
SiTestUnit.LogMessage(‘Starting Session1’); // Message shows up correctly as a message

The issues is the follow command

fSiTestUnit.LogText(lvDebug, ‘XML’, LongXMLString);
fSiTestUnit.LogText(lvVerbose, ‘XML’, LongXMLString);

The value here only shows up under “All Log Entries” and not a filter view for debug or verbose.

Any chance I am doing something wrong. I am using your build and Delphi 6




Hi James,

SmartInspect differentiates between log levels and so called log entry types. Log levels (lvDebug, lvVerbose etc.) are currently exclusively used for client side filtering in your application.

With the log level, you can control which log messages are written to a log file or are sent to the Console. You can set the log level with the TSmartInspect.Level and TSiSession.Level properties, for example:

If you increase the log level to lvMessage, only messages with a log level of lvMessage or higher are sent to the Console. The other messages are filtered out directly in your application and never reach the Console.

The log entry type, on the other hand, represent the type of a log message and is mostly used for identifying a message in the Console.

By looking at this log entry type, the Console decides what to do with a log message. In most cases, the log entry type is only responsible for choosing the correct icon for a message. Some messages (EnterMethod, LeaveMethod or Separator) are handled special and instruct the Console to indent the message tree or to draw a line separator, for example.

Where it gets a bit confusing is the fact that there are also log entry types called Debug, Verbose etc. These log entry types are only generated by the corresponding log methods like LogDebug, LogVerbose etc. We are looking into adding support for log levels to the Console, but as this means that we also have to change the protocols and log file formats, this will take a while.

Probably the best way to accomplish what you are trying to do (filtering in the Console) is to use sessions.