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

23 lines
390 B
PowerShell
Raw Permalink Normal View History

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