diff --git a/packages/common.vm/common.vm.nuspec b/packages/common.vm/common.vm.nuspec index e0e3d673..04986f52 100755 --- a/packages/common.vm/common.vm.nuspec +++ b/packages/common.vm/common.vm.nuspec @@ -2,7 +2,7 @@ common.vm - 0.0.0.20241216 + 0.0.0.20250116 Common libraries for VM-packages Mandiant diff --git a/packages/common.vm/tools/vm.common/vm.common.psm1 b/packages/common.vm/tools/vm.common/vm.common.psm1 index e18ee80a..6ff521ef 100755 --- a/packages/common.vm/tools/vm.common/vm.common.psm1 +++ b/packages/common.vm/tools/vm.common/vm.common.psm1 @@ -70,11 +70,18 @@ function VM-Remove-PreviousZipPackage { } } + function VM-Write-Log { +<# +.SYNOPSIS + Log message to file and console. +.DESCRIPTION + Log message to log file with extra useful information and to console with a color depending on the level. +#> [CmdletBinding()] Param( [Parameter(Mandatory=$true, Position=0)] - [ValidateSet("INFO","WARN","ERROR","FATAL","DEBUG")] + [ValidateSet("INFO","WARN","ERROR")] [String] $level, [Parameter(Mandatory=$true, Position=1)] [string] $message @@ -106,11 +113,11 @@ function VM-Write-Log { # Log message to console if (($level -eq "ERROR") -Or ($level -eq "FATAL")) { - Write-Host -ForegroundColor Red -BackgroundColor White "$line" + Write-Host -ForegroundColor Red -BackgroundColor White "$message" } elseif ($level -eq "WARN") { - Write-Host -ForegroundColor Yellow "$line" + Write-Host -ForegroundColor Yellow "$message" } else { - Write-Host "$line" + Write-Host -ForegroundColor Cyan "$message" } }