APIs for writing log messages

Introduction

The APIs described below generate log messages and are supplied by the static Log C# class.

If the messages are generated by Q Studio at design time, or by a Q Application in execution on a connected target at runtime, these messages can be displayed in Q Studio in the log panel (see Q Studio Interface). The message category (argument category available in some APIs) can be displayed in Q Studio in the log panel, in the Module column.

Log.Debug(message)

Generates the debug message passed as argument.

static void Debug(string message);

Arguments

message string

Message to generate.

Example

Log.Debug("This is a debug message");

Log.Debug(category, message)

Generates the debug message passed as second argument and associates it with the category passed as first argument.

static void Debug(string category, string message);

Arguments

category string

Message category.

message string

Message to generate.

Example

Log.Debug("CustomCategory", "This is a debug message");

Log.Error(message)

Generates the error message passed as argument.

static void Error(string message);

Arguments

message string

Message to generate.

Example

Log.Error("This is an error message");

Log.Error(category, message)

Generates the error message passed as second argument and associates it with the category passed as first argument.

static void Error(string category, string message);

Arguments

message string

Message to generate.

Example

Log.Error("CustomCategory", "This is an error message");

Log.Info(message)

Generates the informational message passed as argument.

static void Info(string message);

Arguments

message string

Message to generate.

Examples

Log.Info("This is an info message");

Log.Info(category, message)

Generates the informational message passed as second argument and associates it with the category passed as first argument.

static void Info(string category, string message);

Arguments

message string

Message to generate.

Examples

Log.Info("CustomCategory", "This is an info message");

Log.Node(node, verbose)

Returns a string containing the path of the node passed as argument. The second argument, optional, enables/disables insertion of the NodeID and object type in the returned string.

static string Node(IUANode node, bool verbose);

Arguments

node IUANode

Node for which the path is to be generated in string format

verbose bool

false (default) = does not insert additional information in the string returned.

true = inserts NodeID and object type in the string returned.

Returns

string

Path of the node passed as argument. Based on the verbose argument value, it can also contain the NodeId and the object type.

Examples

Below is an example in which the API Log.Info generates a message consisting of the “Error on node ” string and the NetLogic path, returned as a string by the API Log.Node:

Log.Info("Error on node " + Log.Node(LogicObject);

Log.Warning(message)

Generates the warning message passed as argument.

static void Warning(string message);

Arguments

message string

Message to generate.

Example

Log.Warning("This is a warning message");

Log.Warning(category, message)

Generates the warning message passed as second argument and associates it with the category passed as first argument.

static void Warning(string category, string message);

Arguments

message string

Message to generate.

Example

Log.Warning("CustomCategory", "This is a warning message");