Created
April 11, 2017 18:36
-
-
Save milesgratz/7fa7b2f14553c6aa97f2181c779e392b to your computer and use it in GitHub Desktop.
Write-Log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Write-Log { | |
param( | |
$Message, | |
$logPath, | |
$Color = "Yellow" | |
) | |
Write-Host "$Message" -ForegroundColor $Color | |
If ($logPath -ne $null) | |
{ | |
$logTime = Get-Date -format "yyyy-MMM-d H:mm:ss zzz" | |
Write-Output "[$logTime] $Message" | Out-File -Append $logPath | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment