PureStorage.Logger.ps1
<# .Description New-PhoneHomeWorkflowLogEntry phonehomes log messages following octilion pattern through the FlashArray REST API #> function New-PhoneHomeWorkflowLogEntry { Param ( [Parameter(Mandatory = $true)] [PureStorage.FlashArray.Rest.Rest2Api] $RestClient, [Parameter(Mandatory = $true)] [ValidateSet("Begin", "Error", "Complete")] [string] $Event, [Parameter(Mandatory = $true)] [string] $ID, [Parameter(Mandatory = $true)] [string] $Name, [Parameter(Mandatory = $false)] [string] $Context, [Parameter(Mandatory = $false)] [string] $ErrorMessage ) $plugin_id = "PureStorage.CBS.AVS" $plugin_thread_id = "000" $Prefix = "<$($plugin_id)>[$($plugin_thread_id)] __TELEMETRY__" if(-not $Context) { $Context = "N/A" } if (-not $ErrorMessage){ $ErrorMessage = "N/A" } $Message = "$($Prefix) Event=$($Event), ID=$($ID), Name=$($Name), Context=$($Context), Error=$($ErrorMessage)" try { $LogMessage = New-Object -TypeName "PureStorage.Rest.PhoneHomeLog" $LogMessage.severity = [PureStorage.Rest.PhoneHomeseverityLevel]::INFO $LogMessage.utc_time = (Get-Date).ToUniversalTime() $LogMessage.Message = $Message $RestClient.LogRawPhoneHomeMessage($LogMessage) } catch { # This should not be a show stopper } } function New-WorkflowID { return (New-Guid).ToString().replace("-", "").ToUpper() } |