From caa385036ea6cfafcecc37cdf39c0be25a5e10e2 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Fri, 23 Sep 2016 09:06:56 -0500 Subject: [PATCH] (GH-976) PowerShell Functions Use Log Call Method In all of the appropriate methods, ensure they log that they have been called. Many of them had a debug message already that was outdated and needed replaced. Update them to use the function that provides the logging by inspecting the invocation and bound parameters. --- .../helpers/functions/Get-CheckSumValid.ps1 | 4 +++- .../helpers/functions/Get-ChocolateyUnzip.ps1 | 2 +- .../helpers/functions/Get-ChocolateyWebFile.ps1 | 3 ++- .../helpers/functions/Get-EnvironmentVariable.ps1 | 3 +++ .../helpers/functions/Get-EnvironmentVariableNames.ps1 | 2 ++ src/chocolatey.resources/helpers/functions/Get-FtpFile.ps1 | 2 +- .../helpers/functions/Get-OSArchitectureWidth.ps1 | 3 ++- .../helpers/functions/Get-ToolsLocation.ps1 | 4 +++- .../helpers/functions/Get-UACEnabled.ps1 | 4 ++-- .../helpers/functions/Get-UninstallRegistryKey.ps1 | 5 +++-- src/chocolatey.resources/helpers/functions/Get-WebFile.ps1 | 4 ++-- .../helpers/functions/Get-WebFileName.ps1 | 2 +- .../helpers/functions/Get-WebHeaders.ps1 | 4 +++- .../helpers/functions/Install-BinFile.ps1 | 3 ++- .../helpers/functions/Install-ChocolateyDesktopLink.ps1 | 3 ++- .../functions/Install-ChocolateyEnvironmentVariable.ps1 | 3 ++- .../helpers/functions/Install-ChocolateyExplorerMenuItem.ps1 | 4 +++- .../helpers/functions/Install-ChocolateyFileAssociation.ps1 | 3 ++- .../helpers/functions/Install-ChocolateyInstallPackage.ps1 | 3 ++- .../helpers/functions/Install-ChocolateyPackage.ps1 | 2 +- .../helpers/functions/Install-ChocolateyZipPackage.ps1 | 3 ++- src/chocolatey.resources/helpers/functions/Install-Vsix.ps1 | 2 +- .../helpers/functions/Set-EnvironmentVariable.ps1 | 2 +- .../helpers/functions/Start-ChocolateyProcessAsAdmin.ps1 | 4 ++-- .../helpers/functions/UnInstall-ChocolateyZipPackage.ps1 | 3 ++- .../helpers/functions/Uninstall-BinFile.ps1 | 3 ++- .../functions/Uninstall-ChocolateyEnvironmentVariable.ps1 | 3 ++- .../helpers/functions/Uninstall-ChocolateyPackage.ps1 | 2 +- .../helpers/functions/Update-SessionEnvironment.ps1 | 3 ++- .../helpers/functions/Write-ChocolateyFailure.ps1 | 2 ++ .../helpers/functions/Write-ChocolateySuccess.ps1 | 2 ++ .../helpers/functions/Write-FileUpdateLog.ps1 | 3 ++- 32 files changed, 63 insertions(+), 32 deletions(-) diff --git a/src/chocolatey.resources/helpers/functions/Get-CheckSumValid.ps1 b/src/chocolatey.resources/helpers/functions/Get-CheckSumValid.ps1 index b946329487..85e23353ae 100644 --- a/src/chocolatey.resources/helpers/functions/Get-CheckSumValid.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-CheckSumValid.ps1 @@ -121,7 +121,9 @@ param( [parameter(Mandatory=$false, Position=3)][string] $originalUrl = '', [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) - Write-Debug "Running 'Get-ChecksumValid' with file:'$file', checksum: '$checksum', checksumType: '$checksumType', originalUrl: '$originalUrl'"; + + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters + if ($env:ChocolateyIgnoreChecksums -eq 'true') { Write-Warning "Ignoring checksums due to feature checksumFiles turned off or option --ignore-checksums set." return diff --git a/src/chocolatey.resources/helpers/functions/Get-ChocolateyUnzip.ps1 b/src/chocolatey.resources/helpers/functions/Get-ChocolateyUnzip.ps1 index 810d83a5cb..1c684027b8 100644 --- a/src/chocolatey.resources/helpers/functions/Get-ChocolateyUnzip.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-ChocolateyUnzip.ps1 @@ -84,7 +84,7 @@ param( $fileFullPath=join-path $fileFullPath $specificFolder } - Write-Debug "Running 'Get-ChocolateyUnzip' with fileFullPath:`'$fileFullPath`'', destination: `'$destination`', specificFolder: `'$specificFolder``, packageName: `'$packageName`'"; + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters if ($packageName) { $packagelibPath = $env:ChocolateyPackageFolder diff --git a/src/chocolatey.resources/helpers/functions/Get-ChocolateyWebFile.ps1 b/src/chocolatey.resources/helpers/functions/Get-ChocolateyWebFile.ps1 index 5312b7d818..4c0f12d6ee 100644 --- a/src/chocolatey.resources/helpers/functions/Get-ChocolateyWebFile.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-ChocolateyWebFile.ps1 @@ -200,7 +200,8 @@ param( [parameter(Mandatory=$false)][switch] $forceDownload, [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) - Write-Debug "Running 'Get-ChocolateyWebFile' for $packageName with url:`'$url`', fileFullPath:`'$fileFullPath`', url64bit:`'$url64bit`', checksum: `'$checksum`', checksumType: `'$checksumType`', checksum64: `'$checksum64`', checksumType64: `'$checksumType64`'"; + + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters $url32bit = $url diff --git a/src/chocolatey.resources/helpers/functions/Get-EnvironmentVariable.ps1 b/src/chocolatey.resources/helpers/functions/Get-EnvironmentVariable.ps1 index de6d75343c..cef7b2671e 100644 --- a/src/chocolatey.resources/helpers/functions/Get-EnvironmentVariable.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-EnvironmentVariable.ps1 @@ -61,6 +61,9 @@ param( [Parameter(Mandatory=$false)][switch] $PreserveVariables = $false, [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) + + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters + [string] $MACHINE_ENVIRONMENT_REGISTRY_KEY_NAME = "SYSTEM\CurrentControlSet\Control\Session Manager\Environment\"; [Microsoft.Win32.RegistryKey] $win32RegistryKey = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey($MACHINE_ENVIRONMENT_REGISTRY_KEY_NAME) if ($Scope -eq [System.EnvironmentVariableTarget]::User) { diff --git a/src/chocolatey.resources/helpers/functions/Get-EnvironmentVariableNames.ps1 b/src/chocolatey.resources/helpers/functions/Get-EnvironmentVariableNames.ps1 index fc91d55d72..5d76aef00d 100644 --- a/src/chocolatey.resources/helpers/functions/Get-EnvironmentVariableNames.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-EnvironmentVariableNames.ps1 @@ -45,6 +45,8 @@ Get-EnvironmentVariable Set-EnvironmentVariable #> + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters + # HKCU:\Environment may not exist in all Windows OSes (such as Server Core). switch ($Scope) { 'User' { Get-Item 'HKCU:\Environment' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Property } diff --git a/src/chocolatey.resources/helpers/functions/Get-FtpFile.ps1 b/src/chocolatey.resources/helpers/functions/Get-FtpFile.ps1 index 49819ffff4..bb85aacb37 100644 --- a/src/chocolatey.resources/helpers/functions/Get-FtpFile.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-FtpFile.ps1 @@ -70,7 +70,7 @@ param( [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) - Write-Debug "Running 'Get-FtpFile' for $fileName with url:'$url', userName: '$userName', password: '$password'"; + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters if ($url -eq $null -or $url -eq '') { Write-Warning "Url parameter is empty, Get-FtpFile has nothing to do." diff --git a/src/chocolatey.resources/helpers/functions/Get-OSArchitectureWidth.ps1 b/src/chocolatey.resources/helpers/functions/Get-OSArchitectureWidth.ps1 index b6521791bd..a6fbbd768d 100644 --- a/src/chocolatey.resources/helpers/functions/Get-OSArchitectureWidth.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-OSArchitectureWidth.ps1 @@ -42,7 +42,8 @@ depending on wether or not the bit width matches. param( $compare ) - Write-Debug "Running 'Get-OSArchitectureWidth'" + + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters $bits = 64 if (([System.IntPtr]::Size -eq 4) -and (Test-Path env:\PROCESSOR_ARCHITEW6432)) { diff --git a/src/chocolatey.resources/helpers/functions/Get-ToolsLocation.ps1 b/src/chocolatey.resources/helpers/functions/Get-ToolsLocation.ps1 index 1f9c9c2df0..2cd7d292d7 100644 --- a/src/chocolatey.resources/helpers/functions/Get-ToolsLocation.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-ToolsLocation.ps1 @@ -43,8 +43,10 @@ None .OUTPUTS None #> - Write-Debug "Running 'Get-ToolsLocation'"; + $invocation = $MyInvocation + Write-FunctionCallLogMessage -Invocation $invocation -Parameters $PSBoundParameters + if ($invocation -ne $null -and $invocation.InvocationName -ne $null -and $invocation.InvocationName.ToLower() -eq 'get-binroot') { Write-Host "Get-BinRoot is going to be deprecated in v1 and removed in v2. It is being replaced with Get-ToolsLocation, however many packages no longer require a special separate directory since package folders no longer have versions on them. Some do though and should continue to use Get-ToolsLocation." } diff --git a/src/chocolatey.resources/helpers/functions/Get-UACEnabled.ps1 b/src/chocolatey.resources/helpers/functions/Get-UACEnabled.ps1 index 8741b13325..126281b040 100644 --- a/src/chocolatey.resources/helpers/functions/Get-UACEnabled.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-UACEnabled.ps1 @@ -32,12 +32,12 @@ None System.Boolean #> + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters + $uacRegPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" $uacRegValue = "EnableLUA" $uacEnabled = $false - Write-Debug "Running 'Get-UACEnabled'" - # http://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx $osVersion = [Environment]::OSVersion.Version if ($osVersion -ge [Version]'6.0') diff --git a/src/chocolatey.resources/helpers/functions/Get-UninstallRegistryKey.ps1 b/src/chocolatey.resources/helpers/functions/Get-UninstallRegistryKey.ps1 index a7dcb80fb9..038f3f78c2 100644 --- a/src/chocolatey.resources/helpers/functions/Get-UninstallRegistryKey.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-UninstallRegistryKey.ps1 @@ -91,9 +91,10 @@ param( [string] $softwareName, [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) - Write-Debug "Running 'Get-UninstallRegistryKey' for `'$env:ChocolateyPackageName`' with SoftwareName:`'$softwareName`'"; - if ($softwareName -eq $null -or $softwareName -eq '') { + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters + + if ($softwareName -eq $null -or $softwareName -eq '') { throw "$SoftwareName cannot be empty for Get-UninstallRegistryKey" } diff --git a/src/chocolatey.resources/helpers/functions/Get-WebFile.ps1 b/src/chocolatey.resources/helpers/functions/Get-WebFile.ps1 index f0730ef06c..47e1c6cad2 100644 --- a/src/chocolatey.resources/helpers/functions/Get-WebFile.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-WebFile.ps1 @@ -90,8 +90,8 @@ param( [parameter(Mandatory=$false)][hashtable] $options = @{Headers=@{}}, [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) - Write-Debug "Running 'Get-WebFile' for $fileName with url:`'$url`', userAgent: `'$userAgent`' "; - #if ($url -eq '' return) + + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters try { $uri = [System.Uri]$url diff --git a/src/chocolatey.resources/helpers/functions/Get-WebFileName.ps1 b/src/chocolatey.resources/helpers/functions/Get-WebFileName.ps1 index c678a8c08f..74b943af44 100644 --- a/src/chocolatey.resources/helpers/functions/Get-WebFileName.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-WebFileName.ps1 @@ -72,7 +72,7 @@ param( [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) - Write-Debug "Running 'Get-WebFileName' to determine name with url:'$url', defaultName:'$defaultName'"; + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters $originalFileName = $defaultName $fileName = $null diff --git a/src/chocolatey.resources/helpers/functions/Get-WebHeaders.ps1 b/src/chocolatey.resources/helpers/functions/Get-WebHeaders.ps1 index 5568142278..7d699caabd 100644 --- a/src/chocolatey.resources/helpers/functions/Get-WebHeaders.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-WebHeaders.ps1 @@ -55,7 +55,9 @@ param( [parameter(Mandatory=$false, Position=1)][string] $userAgent = 'chocolatey command line', [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) - Write-Debug "Running 'Get-WebHeaders' with url:`'$url`', userAgent: `'$userAgent`'"; + + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters + if ($url -eq '') { return @{} } $request = [System.Net.HttpWebRequest]::Create($url); diff --git a/src/chocolatey.resources/helpers/functions/Install-BinFile.ps1 b/src/chocolatey.resources/helpers/functions/Install-BinFile.ps1 index 0a449cceb0..c25bc90387 100644 --- a/src/chocolatey.resources/helpers/functions/Install-BinFile.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-BinFile.ps1 @@ -81,7 +81,8 @@ param( [parameter(Mandatory=$false)][string] $command = '', [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) - Write-Debug "Running 'Install-BinFile' for $name with path:`'$path`'|`$useStart:$useStart|`$command:$command"; + + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters $nugetPath = [System.IO.Path]::GetFullPath((Join-Path "$helpersPath" '..\')) $nugetExePath = Join-Path "$nugetPath" 'bin' diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyDesktopLink.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyDesktopLink.ps1 index 91274c4fde..749d0c509b 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyDesktopLink.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyDesktopLink.ps1 @@ -58,7 +58,8 @@ param( [parameter(Mandatory=$true, Position=0)][string] $targetFilePath, [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) - Write-Debug "Running 'Install-ChocolateyDesktopLink' with targetFilePath:`'$targetFilePath`'"; + + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters if (!$targetFilePath) { throw "Install-ChocolateyDesktopLink - `$targetFilePath can not be null." diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyEnvironmentVariable.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyEnvironmentVariable.ps1 index 09ba1635d2..c4deec455c 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyEnvironmentVariable.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyEnvironmentVariable.ps1 @@ -92,7 +92,8 @@ param( [System.EnvironmentVariableTarget] $variableType = [System.EnvironmentVariableTarget]::User, [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) - Write-Debug "Running 'Install-ChocolateyEnvironmentVariable' with variableName:`'$variableName`' and variableValue:`'$variableValue`'"; + + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters if ($variableType -eq [System.EnvironmentVariableTarget]::Machine) { if (Test-ProcessAdminRights) { diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyExplorerMenuItem.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyExplorerMenuItem.ps1 index c06ad5aa42..a4ba81599c 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyExplorerMenuItem.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyExplorerMenuItem.ps1 @@ -88,7 +88,9 @@ param( [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) try { - Write-Debug "Running 'Install-ChocolateyExplorerMenuItem' with menuKey:'$menuKey', menuLabel:'$menuLabel', command:'$command', type '$type'" + + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters + if($type -eq "file") {$key = "*"} elseif($type -eq "directory") {$key="directory"} else{ return 1} $elevated = "` if( -not (Test-Path -path HKCR:) ) {New-PSDrive -Name HKCR -PSProvider registry -Root Hkey_Classes_Root};` diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyFileAssociation.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyFileAssociation.ps1 index e4c806c64c..d007cc3777 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyFileAssociation.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyFileAssociation.ps1 @@ -57,7 +57,8 @@ param( [parameter(Mandatory=$true, Position=1)][string] $executable, [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) - Write-Debug "Running 'Install-ChocolateyFileAssociation' associating $extension with `'$executable`'"; + + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters if(-not(Test-Path $executable)){ $errorMessage = "`'$executable`' does not exist, not able to create association" Write-Error $errorMessage diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 index 6b84ab2384..776cc578b0 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 @@ -154,7 +154,8 @@ param( ) [string]$silentArgs = $silentArgs -join ' ' - Write-Debug "Running 'Install-ChocolateyInstallPackage' for $packageName with file:`'$file`', args: `'$silentArgs`', fileType: `'$fileType`', validExitCodes: `'$validExitCodes`', useOnlyPackageSilentArguments: '$($useOnlyPackageSilentArguments.IsPresent)'"; + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters + $installMessage = "Installing $packageName..." Write-Host $installMessage diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 index 18b46b281a..b9e981d730 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 @@ -275,7 +275,7 @@ param( ) [string]$silentArgs = $silentArgs -join ' ' - Write-Debug "Running 'Install-ChocolateyPackage' for $packageName with url:'$url', args:'$silentArgs', fileType:'$fileType', url64bit:'$url64bit', checksum:'$checksum', checksumType:'$checksumType', checksum64:'$checksum64', checksumType64:'$checksumType64', validExitCodes:'$validExitCodes'"; + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters $chocTempDir = $env:TEMP $tempDir = Join-Path $chocTempDir "$($env:chocolateyPackageName)" diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyZipPackage.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyZipPackage.ps1 index 6e7e8caca6..c192897f92 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyZipPackage.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyZipPackage.ps1 @@ -173,7 +173,8 @@ param( [parameter(Mandatory=$false)][hashtable] $options = @{Headers=@{}}, [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) - Write-Debug "Running 'Install-ChocolateyZipPackage' for $packageName with url:`'$url`', unzipLocation: `'$unzipLocation`', url64bit: `'$url64bit`', specificFolder: `'$specificFolder`', checksum: `'$checksum`', checksumType: `'$checksumType`', checksum64: `'$checksum64`', checksumType64: `'$checksumType64`' "; + + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters $fileType = 'zip' diff --git a/src/chocolatey.resources/helpers/functions/Install-Vsix.ps1 b/src/chocolatey.resources/helpers/functions/Install-Vsix.ps1 index 0227421583..448c4822bf 100644 --- a/src/chocolatey.resources/helpers/functions/Install-Vsix.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-Vsix.ps1 @@ -34,7 +34,7 @@ param ( [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) - Write-Debug "Running 'Install-Vsix' with installer:'$installer', installFile: '$installFile'"; + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters if ($env:chocolateyPackageName -ne $null -and $env:chocolateyPackageName -eq $env:ChocolateyInstallDirectoryPackage) { Write-Warning "Install Directory override not available for VSIX packages." diff --git a/src/chocolatey.resources/helpers/functions/Set-EnvironmentVariable.ps1 b/src/chocolatey.resources/helpers/functions/Set-EnvironmentVariable.ps1 index 73b0258390..9c75127756 100644 --- a/src/chocolatey.resources/helpers/functions/Set-EnvironmentVariable.ps1 +++ b/src/chocolatey.resources/helpers/functions/Set-EnvironmentVariable.ps1 @@ -61,7 +61,7 @@ param ( [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) - Write-Debug "Calling Set-EnvironmentVariable with `$Name = '$Name', `$Value = '$Value', `$Scope = '$Scope'" + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters if ($Scope -eq [System.EnvironmentVariableTarget]::Process -or $Value -eq $null -or $Value -eq '') { return [Environment]::SetEnvironmentVariable($Name, $Value, $Scope) diff --git a/src/chocolatey.resources/helpers/functions/Start-ChocolateyProcessAsAdmin.ps1 b/src/chocolatey.resources/helpers/functions/Start-ChocolateyProcessAsAdmin.ps1 index 459e93c034..fb58d8b250 100644 --- a/src/chocolatey.resources/helpers/functions/Start-ChocolateyProcessAsAdmin.ps1 +++ b/src/chocolatey.resources/helpers/functions/Start-ChocolateyProcessAsAdmin.ps1 @@ -103,8 +103,8 @@ param( [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) [string]$statements = $statements -join ' ' - - Write-Debug "Running 'Start-ChocolateyProcessAsAdmin' with exeToRun:'$exeToRun', statements: '$statements', workingDirectory: '$workingDirectory' "; + + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters try{ if ($exeToRun -ne $null) { $exeToRun = $exeToRun -replace "`0", "" } diff --git a/src/chocolatey.resources/helpers/functions/UnInstall-ChocolateyZipPackage.ps1 b/src/chocolatey.resources/helpers/functions/UnInstall-ChocolateyZipPackage.ps1 index 874c4f7c40..d449a83c55 100644 --- a/src/chocolatey.resources/helpers/functions/UnInstall-ChocolateyZipPackage.ps1 +++ b/src/chocolatey.resources/helpers/functions/UnInstall-ChocolateyZipPackage.ps1 @@ -58,7 +58,8 @@ param( [parameter(Mandatory=$true, Position=1)][string] $zipFileName, [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) - Write-Debug "Running 'UnInstall-ChocolateyZipPackage' for $packageName $zipFileName " + + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters $packagelibPath=$env:chocolateyPackageFolder $zipContentFile=(join-path $packagelibPath $zipFileName) + ".txt" diff --git a/src/chocolatey.resources/helpers/functions/Uninstall-BinFile.ps1 b/src/chocolatey.resources/helpers/functions/Uninstall-BinFile.ps1 index 1848058b19..749dd73b4d 100644 --- a/src/chocolatey.resources/helpers/functions/Uninstall-BinFile.ps1 +++ b/src/chocolatey.resources/helpers/functions/Uninstall-BinFile.ps1 @@ -55,7 +55,8 @@ param( [parameter(Mandatory=$false, Position=1)][string] $path, [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) - Write-Debug "Running 'Uninstall-BinFile' for $name with path:`'$path`'"; + + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters $nugetPath = [System.IO.Path]::GetFullPath((Join-Path "$helpersPath" '..\')) $nugetExePath = Join-Path "$nugetPath" 'bin' diff --git a/src/chocolatey.resources/helpers/functions/Uninstall-ChocolateyEnvironmentVariable.ps1 b/src/chocolatey.resources/helpers/functions/Uninstall-ChocolateyEnvironmentVariable.ps1 index 760e31650f..0cebe8a301 100644 --- a/src/chocolatey.resources/helpers/functions/Uninstall-ChocolateyEnvironmentVariable.ps1 +++ b/src/chocolatey.resources/helpers/functions/Uninstall-ChocolateyEnvironmentVariable.ps1 @@ -76,7 +76,8 @@ param( [System.EnvironmentVariableTarget] $variableType = [System.EnvironmentVariableTarget]::User, [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) - Write-Debug "Running 'Uninstall-ChocolateyEnvironmentVariable' with variableName:'$variableName' and variableType:'$variableType'"; + + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters if ($variableType -eq [System.EnvironmentVariableTarget]::Machine) { if (Test-ProcessAdminRights) { diff --git a/src/chocolatey.resources/helpers/functions/Uninstall-ChocolateyPackage.ps1 b/src/chocolatey.resources/helpers/functions/Uninstall-ChocolateyPackage.ps1 index 743cfedf16..4819c5e8be 100644 --- a/src/chocolatey.resources/helpers/functions/Uninstall-ChocolateyPackage.ps1 +++ b/src/chocolatey.resources/helpers/functions/Uninstall-ChocolateyPackage.ps1 @@ -115,7 +115,7 @@ param( ) [string]$silentArgs = $silentArgs -join ' ' - Write-Debug "Running 'Uninstall-ChocolateyPackage' for $packageName with fileType:`'$fileType`', silentArgs: `'$silentArgs`', file: `'$file`'"; + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters $installMessage = "Uninstalling $packageName..." write-host $installMessage diff --git a/src/chocolatey.resources/helpers/functions/Update-SessionEnvironment.ps1 b/src/chocolatey.resources/helpers/functions/Update-SessionEnvironment.ps1 index b1e9496dd9..f25ca93807 100644 --- a/src/chocolatey.resources/helpers/functions/Update-SessionEnvironment.ps1 +++ b/src/chocolatey.resources/helpers/functions/Update-SessionEnvironment.ps1 @@ -45,7 +45,8 @@ None None #> - Write-Debug "Running 'Update-SessionEnvironment'" + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters + $refreshEnv = $false $invocation = $MyInvocation if ($invocation.InvocationName -eq 'refreshenv') { diff --git a/src/chocolatey.resources/helpers/functions/Write-ChocolateyFailure.ps1 b/src/chocolatey.resources/helpers/functions/Write-ChocolateyFailure.ps1 index cf715bb226..8275bf8557 100644 --- a/src/chocolatey.resources/helpers/functions/Write-ChocolateyFailure.ps1 +++ b/src/chocolatey.resources/helpers/functions/Write-ChocolateyFailure.ps1 @@ -50,6 +50,8 @@ param( [string] $failureMessage, [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) + + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters Write-Warning "Write-ChocolateyFailure is deprecated and will be removed in v2. If you are the package maintainer, please use 'throw `$_.Exception' instead." $error | %{ $_.Exception | fl * | Out-String } diff --git a/src/chocolatey.resources/helpers/functions/Write-ChocolateySuccess.ps1 b/src/chocolatey.resources/helpers/functions/Write-ChocolateySuccess.ps1 index 8a5f7a9152..5bb7f7c76a 100644 --- a/src/chocolatey.resources/helpers/functions/Write-ChocolateySuccess.ps1 +++ b/src/chocolatey.resources/helpers/functions/Write-ChocolateySuccess.ps1 @@ -46,5 +46,7 @@ param( [string] $packageName, [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) + + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters Write-Warning "Write-ChocolateySuccess is deprecated and will be removed in v2. If you are the maintainer, please remove it from your package file." } diff --git a/src/chocolatey.resources/helpers/functions/Write-FileUpdateLog.ps1 b/src/chocolatey.resources/helpers/functions/Write-FileUpdateLog.ps1 index 5a314d80ec..efc4a7aa4d 100644 --- a/src/chocolatey.resources/helpers/functions/Write-FileUpdateLog.ps1 +++ b/src/chocolatey.resources/helpers/functions/Write-FileUpdateLog.ps1 @@ -53,7 +53,8 @@ param ( [object[]] $argumentList, [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) - Write-Debug "Running 'Write-FileUpdateLog' with logFilePath:`'$logFilePath`'', locationToMonitor:$locationToMonitor, Operation: `'$scriptToRun`'"; + + Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters Write-Warning "Write-FileUpdateLog has been deprecated and will be removed in v1."