From c244542371aead0c0e1f94796c5f5bd0e3b27ac6 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Tue, 5 Dec 2017 16:48:11 +0100 Subject: [PATCH] Minor logging changes. Refers to #13 --- AutoTx/Resources/Update-AutoTxService.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/AutoTx/Resources/Update-AutoTxService.ps1 b/AutoTx/Resources/Update-AutoTxService.ps1 index 68c73fc..b83535a 100644 --- a/AutoTx/Resources/Update-AutoTxService.ps1 +++ b/AutoTx/Resources/Update-AutoTxService.ps1 @@ -90,7 +90,7 @@ function Update-FileIfNewer([string]$SourcePath, [string]$Destination) { $SrcFileSuffix = [io.path]::GetExtension($SrcFile) $DstPath = "$($Destination)\$($SrcFile)" if (-Not (Test-Path "$DstPath")) { - Write-Host "File not existing in destination, NOT UPDATING: $DstPath" + Log-Info "File not existing in destination, NOT UPDATING: $($DstPath)" Return } @@ -104,14 +104,15 @@ function Update-FileIfNewer([string]$SourcePath, [string]$Destination) { $BakTimeStamp = Get-Date -Format s | foreach {$_ -replace ":", "."} $BakName = "$($SrcFileNoSuffix)_pre-$BakTimeStamp$SrcFileSuffix" - Write-Host "Creating backup: $($BakName)" Rename-Item "$DstPath" "$Destination\$BakName" + Log-Info "Creating backup of '$($DstPath)' to '$($BakName)'." try { Copy-Item -Path $SourcePath -Destination $Destination -ErrorAction Stop + Log-Info "Updated config file '$($DstPath)'." } catch { $ex = $_.Exception.Message - Log-Error -Message "Copying $($SourcePath) FAILED!`n$($ex)" + Log-Error "Copying $($SourcePath) FAILED!`n$($ex)" Exit } } -- GitLab