wingetautoupdate/Winget-AutoUpdate/functions/Write-Log.ps1

14 lines
277 B
PowerShell
Raw Permalink Normal View History

2022-04-13 16:50:06 +00:00
#Write Log Function
2022-03-14 13:55:02 +00:00
2022-03-26 08:22:49 +00:00
function Write-Log ($LogMsg, $LogColor = "White") {
2022-04-13 16:50:06 +00:00
2022-03-14 13:55:02 +00:00
#Get log
$Log = "$(Get-Date -UFormat "%T") - $LogMsg"
2022-04-13 16:50:06 +00:00
2022-03-14 13:55:02 +00:00
#Echo log
$Log | Write-host -ForegroundColor $LogColor
2022-04-13 16:50:06 +00:00
2022-03-14 13:55:02 +00:00
#Write log to file
2022-03-26 08:22:49 +00:00
$Log | Out-File -FilePath $LogFile -Append
2022-04-13 16:50:06 +00:00
}