Skip to content

Instantly share code, notes, and snippets.

@christopherbauer
Created March 30, 2018 20:18
Show Gist options
  • Select an option

  • Save christopherbauer/5971673741533591bdf03fa81fd8e9e6 to your computer and use it in GitHub Desktop.

Select an option

Save christopherbauer/5971673741533591bdf03fa81fd8e9e6 to your computer and use it in GitHub Desktop.
Basic Powershell Log
function log {
param([string] $message, [bool] $isOutput = $true)
$logDate = (get-date).ToUniversalTime()
$logFormatted = $logDate.ToString("yyyy-MM-dd HHmmss zzz")
if($isOutput) {
write-output "$($logFormatted): $message"
}
else {
write-host "$($logFormatted): $message"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment