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

21 lines
377 B
PowerShell
Raw Normal View History

# Write to Log Function
2022-03-14 13:55:02 +00:00
function Write-ToLog
{
# Get log
[CmdletBinding()]
param
(
[string]$LogMsg,
[string]$LogColor = 'White'
)
2022-10-26 22:49:10 +00:00
$Log = ('{0} - {1}' -f (Get-Date -UFormat '%T'), $LogMsg)
2022-04-13 16:50:06 +00:00
#Echo log
$Log | Write-Host -ForegroundColor $LogColor
2022-04-13 16:50:06 +00:00
#Write log to file
$Log | Out-File -FilePath $LogFile -Append -Force -Confirm:$false
2022-10-26 22:49:10 +00:00
}