-
Notifications
You must be signed in to change notification settings - Fork 0
Proxy Functions
The following proxy functions will log anything sent to those proxy functions while keeping the original funtionality of those functions in tact.
Keep in mind, that some messaging will only be logged if it would have been outputted to the screen.
This is configured with the Preference Variables.
So, if you want to see verbose messages, be sure to set $VerbosePreference to Continue.
⚠: Do not get in the habit of using
-Silentor-Logparameters on proxy function calls. The point of PSWriteLog is that the script can be run on a system without PSWriteFunction installed without causing issues. Adding those parameters to a function call, will causea parameter cannot be found that matches parameter name 'Silent'error. However, using$PSDefaultParameterValuesto define parameters that do not exist are not an issue with PowerShell; even with strict mode enabled.
- Logging requires
$DebugPreferenceto not be set toSilentlyContinue. - Prevent output to console:
$PSDefaultParameterValues.Add('Write-Debug:Silent', $true); do not get in the habit of doingWrite-Debug -Silent. - If you look at the code, you'll notice a
NoLogparameter; this is for internal use to prevent looping. Don't use it!
⚠: Do not get in the habit of using
-Silentparameters on proxy function calls.
- Prevent output to console:
$PSDefaultParameterValues.Add('Write-Error:Silent', $true); do not get in the habit of doingWrite-Error -Silent.
⚠: Do not get in the habit of using
-Silentparameters on proxy function calls.
- Prevent output to console:
$PSDefaultParameterValues.Add('Write-Host:Silent', $true); do not get in the habit of doingWrite-Host -Silent.
⚠: Do not get in the habit of using
-Silentparameters on proxy function calls.
- Logging requires
$InformationPreference; PowerShell 5.0+ to not be set toSilentlyContinue. - Prevent output to console:
$PSDefaultParameterValues.Add('Write-Information:Silent', $true); do not get in the habit of doingWrite-Information -Silent.
⚠: Do not get in the habit of using
-Silentparameters on proxy function calls.
- Logging requires
$PSDefaultParameterValues.Add('Write-Output:Log', $true); do not get in the habit of doingWrite-Output -Log.
⚠: Do not get in the habit of using
-Logparameters on proxy function calls.
- We try to capture all of the progress information.
- Logging requires
$VerbosePreferenceto not be set toSilentlyContinue. - Prevent output to console:
$PSDefaultParameterValues.Add('Write-Verbose:Silent', $true); do not get in the habit of doingWrite-Verbose -Silent.
⚠: Do not get in the habit of using
-Silentparameters on proxy function calls.
- Logging requires
$WarningPreferenceto not be set toSilentlyContinue. - Prevent output to console:
$PSDefaultParameterValues.Add('Write-Warning:Silent', $true); do not get in the habit of doingWrite-Warning -Silent.
⚠: Do not get in the habit of using
-Silentparameters on proxy function calls.