ILogger Methods

The ILogger interface exposes the methods listed in the following table:

Methods

Description

ILogger.LogDebug Method (Func<String>)

Logs the supplied message by using a “Debug” level scope.

ILogger.LogDebug Method (String, Func<Object>)

Logs the contents of a specified DataModel instance.

ILogger.LogDebugList Method

Logs the contents in a list of strings.

ILogger.LogError Method (Func<Exception>)

Logs the supplied exception  by using an “Error” level scope.

ILogger.LogError Method (Func<String>)

Logs the supplied message by using an “Error” level scope.

ILogger.LogInfo Method

Logs the supplied message by using an “Information” level scope.

ILogger.LogDebug Method (Func<String>)

The LogDebug method (Func<String>) logs the supplied message by using a Debug level scope.

Namespace – ABSuite.AccessLayer.Connector.Core

Assembly – Unisys.ABSuite.AccessLayer.Connector.Core (in Unisys.ABSuite.AccessLayer.Connector.Core.dll)

Syntax

void LogDebug(
		Func<string> action
)

Argument

  • action – System.Func<String>

    This argument provides a delegate to a function that defines and optionally formats the message to be written to the log file.

ILogger.LogDebug Method (String, Func<Object>)

The LogDebug method (String, Func&ltObject&gt) logs the contents of a specified DataModel instance.

Namespace – ABSuite.AccessLayer.Connector.Core

Assembly – Unisys.ABSuite.AccessLayer.Connector.Core (in Unisys.ABSuite.AccessLayer.Connector.Core.dll)

Syntax

void LogDebug(
   string prefix,
	 Func<Object> action
)

Arguments

  • prefix – System.String

    This argument provides a prefix string to be displayed in the log file.

  • action – System.Func<Object>

    This argument provides the DataModel object to be logged.

ILogger.LogDebugList Method

The LogDebugList method logs the contents in a list of string.

Namespace – ABSuite.AccessLayer.Connector.Core

Assembly – Unisys.ABSuite.AccessLayer.Connector.Core (in Unisys.ABSuite.AccessLayer.Connector.Core.dll)

Syntax

void LogDebugList(
	 string prefix
	 Func<IEnumerable<string>> action
)

Argument

  • prefix – System.String

    This argument provides a prefix string to be displayed in the log file.

  • action – System.Func<Exception>

    This argument provides the string items.

ILogger.LogError Method (Func<Exception>)

The LogError method (Func<Exception>) logs the supplied message by using an Error level scope.

Namespace – ABSuite.AccessLayer.Connector.Core

Assembly – Unisys.ABSuite.AccessLayer.Connector.Core (in Unisys.ABSuite.AccessLayer.Connector.Core.dll)

Syntax

void LogError(
		 Func<Exception> action
)

Argument

  • action – System.Func<Exception>

    This argument provides the exception to be written to the log file.

ILogger.LogError Method (Func<String>)

The LogError method (Func<String>) logs the supplied message by using an Error level scope.

Namespace – ABSuite.AccessLayer.Connector.Core

Assembly – Unisys.ABSuite.AccessLayer.Connector.Core (in Unisys.ABSuite.AccessLayer.Connector.Core.dll)

Syntax

void LogError(
		Func<string> action
)

Argument

  • action – System.Func<String>

    This argument provides a delegate to a function to write the message to the log file.

ILogger.LogInfo Method

The LogInfo method logs the supplied message by using an Information level scope.

Namespace – ABSuite.AccessLayer.Connector.Core

Assembly – Unisys.ABSuite.AccessLayer.Connector.Core (in Unisys.ABSuite.AccessLayer.Connector.Core.dll)

Syntax

void LogInfo(
		Func<string> action
)

Argument

  • action – Func<string>

    This argument provides a delegate to a function that defines and optionally formats the message to be written to the log file.

Using the ILogger Interface for the LogInfo, LogDebug, and LogError Methods

The following code is an example of using the various Logging methods supported by the ILogger interface:

// Create a new connection to the AB Suite host system
   // Use the Access Layer API ConnectionFactory to create an instance of a Connection Interface class
   // The Create method also allows you to initialize the Access Layer API Logging level and location.
   ABSConnection = ConnectionFactory.Create(new Sample.Custom.DataModels.Core.IspecFactory(), level:
          "DEBUG", logPath: @"C:\Temp\MVC");
 
   // Get the Logger object from the IConnection interface
   ApplicationLogger = ABSConnection.Logger;
   
   // Log an information message
   ApplicationLogger.LogInfo(() => "<Client>:: Log Information message.");	

   // Log a Debug message
   ApplicationLogger.LogDebug(() => string.Format("<Client>:: Log Debug message.")); 

// Log an Error message
ApplicationLogger.LogError(() => string.Format("<Client>:: Log Error message!"));