Skip to content

PowerShell Connector Logger

Overview

The logger is a version of the internal UNIFYConnect logging mechanism, that has been made available to the PowerShell connector.

Implementation

Inside any of the PowerShell scripts, access has been allowed to the UNIFYConnect logging mechanism $logger which can be used to log to the configured UNIFYConnect logs.

For example:

PowerShell
$logger.LogInformation("Basic information message";
$logger.LogError("Error message with custom logging level", "Minimal");
$logger.Log("Message with a custom severity type and logging level", "Warning", "Verbose");

Methods

LogInformation

Logs the information message all attached log writers.

Parameter nameTypeDescription
messagestringMessage to be logged.
levelLoggingLevel (optional)The logging level to log this message at.

LogWarning

Logs a warning message to all attached log writers.

Parameter nameTypeDescription
messagestringMessage to be logged.
levelLoggingLevel (optional)The logging level to log this message at.

LogError

Logs an error message to all attached log writers.

Parameter nameTypeDescription
messagestringMessage to be logged.
levelLoggingLevel (optional)The logging level to log this message at.

Log

Logs a message to all attached log writers.

Parameter nameTypeDescription
messagestringMessage to be logged.
severitySeverityTypeSeverity of the log message.
levelLoggingLevelThe logging level to log this message at.

LogException

Logs an exception to all attached log writers.

Parameter nameTypeDescription
exceptionExceptionThe exception to be logged.
severitySeverityTypeSeverity of the log message.
levelLoggingLevel (optional)The logging level to log this message at.

Other details

LoggingLevel

If the logging level is overridden in the PowerShell script, select one that is appropriate for the type of information that is logged. Do not use the logging level to turn logging on or off, this is the role of the logging configuration.

LevelNameDescription
1DiagnosticThis level is for purely diagnostic information.
2VerboseThis level is verbose information, which would normally not be logged.
3NormalThe level is the normal logging level.
4MinimalThis level is the minimal logging level.

SeverityType

LevelNameDescription
1InformationIndicates the log entry item is purely for information and does not necessarily pertain to a state of error.
2WarningIndicates the log entry pertains to a state of warning that may or may not represent a state of error.
3ErrorIndicates a log entry pertaining to a state of error.