Skip to content
< All Topics

Logging and Diagnostic messages

To provide diagnostic, debug or logging messages Experior provides several mechanisms.

Logging

The Experior.Core.Environment.Log class provides the following static methods to write messages to the Log window:

public static void Write(Exception exception);
public static void Write(string message);
public static void Write(Exception se, int id);
public static void Write(string message, bool underline);
public static void Write(string message, Color color);
public static void Write(string message, LogFilter filter);
public static void Write(string message, string hightlight);
public static void Write(string message, bool underline, LogFilter filter);
public static void Write(string message, Color color, LogFilter filter);
public static void Write(string message, string hightlight, Color color);
public static void Write(string message, string hightlight, LogFilter filter);
public static void Write(string message, Color color, bool underline, LogFilter filter);
public static void Write(string message, string hightlight, Color color, bool underline);
public static void Write(string message, string hightlight, Color color, LogFilter filter);
public static void Write(string message, string hightlight, Color color, bool underline, LogFilter filter);

The meaning of the arguments is straightforward;

  • The message is the string that will be logged to the log window (and/or file depending on the properties set by the user in Experior).
  • The highlight is part of the message that will be shown in bold.
  • The color is the color in which the message will be shown.
  • Underline, this boolean indicates whether or not the message will be underlined.
  • The filter corresponds with the chosen filter by the user in the properties of the Log;

To illustrate, the following code:

Experior.Core.Environment.Log.Write("Created sensorpart assembly", "sensorpart", CadetBlue, true, Communication );
Experior.Core.Environment.Log.Write("Created sensorpart assembly", "sensorpart", Red, false, Action);

will be shown as follows (when no filter is applied);

Debug log

Similar to the regular logging there is also the possibility to only log your message in case the debugging option is set in Experior.

In this case the Experior.Core.Environment.Log.Debug class is used with the public static void Write(string message) method.

Example:

Experior.Core.Environment.Log.Debug.Write("This is an example debug message");

Diagnostic info

Experior also provides the possibility to print diagnostic messages to other areas than the logging window.

Therefore the class Experior.Core.Environment.Diagnostic contains the following static methods:

public static void Message(string message);
public static void Message(string message, Color color);
public static void Message(string sender, string message);
public static void Message(string message, Color color, Environment.DiagnosticAction action);
public static void Message(string sender, string message, Color color);
public static void Message(string message, Color color, Environment.DiagnosticAction action, Environment.Signs sign);
public static void Message(string sender, string message, Color color, Environment.DiagnosticAction action);

By default the messages are shown in the status area underneath the working area.

The arguments are:

  • Message: The information that will be shown.
  • Sender: This string appended with a : will be shown before the message. It is mainly used to provide the origin of the message e.g. the Assembly name.
  • Environment.DiagnosticAction: This is an enum with the following possible values;
    ALARM in this case the message will also be shown in the alarm window of experior
    TEMPORARY in this case the message will only be shown for couple of seconds
    TEMPORARYANDLOG in this case the message will only be shown for couple of seconds but it will also be printed to the log window (where it will remain)
    STICKY in this case the message will remain visible in the status area until a new message is requested or until the message is removed or the Clear() method is called of the Diagnostic class
    REMOVE way to remove a STICKY diagnostic message
    NONE
  • Environment.Signs: This is an enum to indicate what icon should be attached to the message in the status area.