Introducing the SmartInspect LogColored method

If you are a .NET, Java or Delphi developer, please take a look at our advanced logging tool SmartInspect.

Another new feature of the SmartInspect libraries included in the upcoming release is the LogColored method of the Session class. With the LogColored method you can, as the name suggests, log a message and specify the background color in the SmartInspect Console.

Using a different background color for certain messages isn’t actually new. Changing the background color for a specific session has been possible since SmartInspect 1.0, but with the new LogColored method you are now able to send a colored message without the need to change the session color. This means, if you want to highlight certain messages with an eye-catching background color, there’s no need anymore to have an own session for this specific color or to switch the color back and forth between message calls:

using System.Drawing;
using Gurock.SmartInspect;

public class Program
{
    public static void Main(string[] args)
    {
        SiAuto.Si.Enabled = true;
        SiAuto.Main.LogColored(Color.LightBlue, “Blue”);
        SiAuto.Main.LogColored(Color.LightYellow, “Yellow”);
        SiAuto.Main.LogColored(Color.LightGray, “Gray”);
    }
}

The example should be quite self-explanatory. After starting it, the output displayed in the SmartInspect Console looks something like this:

LogColored output displayed in the SmartInspect Console

This entry was posted in SmartInspect. Bookmark the permalink. Both comments and trackbacks are currently closed.